My Project
solver_direct_mean.cpp
Go to the documentation of this file.
1 
38 #include "../include/solver_structure.hpp"
39 
41 
42  /*--- Basic array initialization ---*/
43 
44  CD_Inv = NULL; CL_Inv = NULL; CSF_Inv = NULL; CEff_Inv = NULL;
45  CMx_Inv = NULL; CMy_Inv = NULL; CMz_Inv = NULL;
46  CFx_Inv = NULL; CFy_Inv = NULL; CFz_Inv = NULL;
47  CoPx_Inv = NULL; CoPy_Inv = NULL; CoPz_Inv = NULL;
48  Cmu = NULL;
49 
50  CD_Mnt = NULL; CL_Mnt = NULL; CSF_Mnt = NULL; CEff_Mnt = NULL;
51  CMx_Mnt = NULL; CMy_Mnt = NULL; CMz_Mnt = NULL;
52  CFx_Mnt = NULL; CFy_Mnt = NULL; CFz_Mnt = NULL;
53  CoPx_Mnt = NULL; CoPy_Mnt = NULL; CoPz_Mnt = NULL;
54 
55  CPressure = NULL; CPressureTarget = NULL; HeatFlux = NULL; HeatFluxTarget = NULL; YPlus = NULL;
56  ForceInviscid = NULL; MomentInviscid = NULL;
57  ForceMomentum = NULL; MomentMomentum = NULL;
58 
59  /*--- Surface based array initialization ---*/
60 
61  Surface_CL_Inv = NULL; Surface_CD_Inv = NULL; Surface_CSF_Inv = NULL; Surface_CEff_Inv = NULL;
62  Surface_CFx_Inv = NULL; Surface_CFy_Inv = NULL; Surface_CFz_Inv = NULL;
63  Surface_CMx_Inv = NULL; Surface_CMy_Inv = NULL; Surface_CMz_Inv = NULL;
64  Surface_Cmu = NULL;
65 
66  Surface_CL_Mnt = NULL; Surface_CD_Mnt = NULL; Surface_CSF_Mnt = NULL; Surface_CEff_Mnt = NULL;
67  Surface_CFx_Mnt = NULL; Surface_CFy_Mnt = NULL; Surface_CFz_Mnt = NULL;
68  Surface_CMx_Mnt = NULL; Surface_CMy_Mnt = NULL; Surface_CMz_Mnt = NULL;
69 
70  Surface_CL = NULL; Surface_CD = NULL; Surface_CSF = NULL; Surface_CEff = NULL;
71  Surface_CFx = NULL; Surface_CFy = NULL; Surface_CFz = NULL;
72  Surface_CMx = NULL; Surface_CMy = NULL; Surface_CMz = NULL;
73 
74  /*--- Rotorcraft simulation array initialization ---*/
75 
76  CMerit_Inv = NULL; CT_Inv = NULL; CQ_Inv = NULL;
77 
78  CMerit_Mnt = NULL; CT_Mnt = NULL; CQ_Mnt = NULL;
79 
80  /*--- Supersonic simulation array initialization ---*/
81 
82  CEquivArea_Inv = NULL;
83  CNearFieldOF_Inv = NULL;
84 
85  /*--- Engine simulation array initialization ---*/
86 
87  Inflow_MassFlow = NULL; Inflow_Pressure = NULL;
88  Inflow_Mach = NULL; Inflow_Area = NULL;
90  Exhaust_MassFlow = NULL; Exhaust_Area = NULL;
91 
92  /*--- Numerical methods array initialization ---*/
93 
94  iPoint_UndLapl = NULL;
95  jPoint_UndLapl = NULL;
96  LowMach_Precontioner = NULL;
97  Primitive = NULL; Primitive_i = NULL; Primitive_j = NULL;
98  CharacPrimVar = NULL;
99 
100  DonorPrimVar = NULL; DonorGlobalIndex = NULL;
101  ActDisk_DeltaP = NULL; ActDisk_DeltaT = NULL;
102 
103  Smatrix = NULL; Cvector = NULL;
104 
105  Secondary = NULL; Secondary_i = NULL; Secondary_j = NULL;
106 
107  /*--- Fixed CL mode initialization (cauchy criteria) ---*/
108 
109  Cauchy_Value = 0;
110  Cauchy_Func = 0;
111  Old_Func = 0;
112  New_Func = 0;
113  Cauchy_Counter = 0;
114  Cauchy_Serie = NULL;
115 
116  AoA_FD_Change = false;
117 
118  FluidModel = NULL;
119 
120  SlidingState = NULL;
121  SlidingStateNodes = NULL;
122 
123  /*--- Initialize quantities for the average process for internal flow ---*/
124 
125  AverageVelocity = NULL;
126  AverageTurboVelocity = NULL;
129  AverageFlux = NULL;
130  SpanTotalFlux = NULL;
131  AveragePressure = NULL;
132  OldAveragePressure = NULL;
134  ExtAveragePressure = NULL;
135  AverageDensity = NULL;
136  OldAverageDensity = NULL;
137  ExtAverageDensity = NULL;
138  AverageNu = NULL;
139  AverageKine = NULL;
140  AverageOmega = NULL;
141  ExtAverageNu = NULL;
142  ExtAverageKine = NULL;
143  ExtAverageOmega = NULL;
144 
145 
146  /*--- Initialize primitive quantities for turboperformace ---*/
147 
148  DensityIn = NULL;
149  PressureIn = NULL;
150  TurboVelocityIn = NULL;
151  DensityOut = NULL;
152  PressureOut = NULL;
153  TurboVelocityOut = NULL;
154  KineIn = NULL;
155  OmegaIn = NULL;
156  NuIn = NULL;
157  KineOut = NULL;
158  OmegaOut = NULL;
159  NuOut = NULL;
160 
161 
162  /*--- Initialize quantities for Giles BC---*/
163 
164  CkInflow = NULL;
165  CkOutflow1 = NULL;
166  CkOutflow2 = NULL;
167 
168 }
169 
170 CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) : CSolver() {
171 
172  unsigned long iPoint, counter_local = 0, counter_global = 0, iVertex;
173  unsigned short iVar, iDim, iMarker, nLineLets;
174  su2double StaticEnergy, Density, Velocity2, Pressure, Temperature;
175  unsigned short nZone = geometry->GetnZone();
176  bool restart = (config->GetRestart() || config->GetRestart_Flow());
177  bool roe_turkel = (config->GetKind_Upwind_Flow() == TURKEL);
178  bool rans = ((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS));
179  unsigned short direct_diff = config->GetDirectDiff();
180  int Unst_RestartIter;
181  unsigned short iZone = config->GetiZone();
182  bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) ||
183  (config->GetUnsteady_Simulation() == DT_STEPPING_2ND));
184  bool time_stepping = config->GetUnsteady_Simulation() == TIME_STEPPING;
185 
186  bool low_mach_prec = config->Low_Mach_Preconditioning();
187 
188  bool adjoint = (config->GetContinuous_Adjoint()) || (config->GetDiscrete_Adjoint());
189  bool fsi = config->GetFSI_Simulation();
190  bool transp = (config->GetnMarker_Transpiration() > 0);
191  string filename_ = config->GetSolution_FlowFileName();
192 
193  /*--- Check for a restart file to evaluate if there is a change in the angle of attack
194  before computing all the non-dimesional quantities. ---*/
195 
196  if (!(!restart || (iMesh != MESH_0) || nZone > 1)) {
197 
198  /*--- Multizone problems require the number of the zone to be appended. ---*/
199 
200  if (nZone > 1) filename_ = config->GetMultizone_FileName(filename_, iZone);
201 
202  /*--- Modify file name for a dual-time unsteady restart ---*/
203 
204  if (dual_time) {
205  if (adjoint) Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_AdjointIter())-1;
206  else if (config->GetUnsteady_Simulation() == DT_STEPPING_1ST)
207  Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_RestartIter())-1;
208  else Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_RestartIter())-2;
209  filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter);
210  }
211 
212  /*--- Modify file name for a time stepping unsteady restart ---*/
213 
214  if (time_stepping) {
215  if (adjoint) Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_AdjointIter())-1;
216  else Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_RestartIter())-1;
217  filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter);
218  }
219 
220  /*--- Read and store the restart metadata. ---*/
221 
222  Read_SU2_Restart_Metadata(geometry, config, false, filename_);
223 
224  }
225 
226  /*--- Array initialization ---*/
227 
228  /*--- Basic array initialization ---*/
229 
230  CD_Inv = NULL; CL_Inv = NULL; CSF_Inv = NULL; CEff_Inv = NULL;
231  CMx_Inv = NULL; CMy_Inv = NULL; CMz_Inv = NULL;
232  CFx_Inv = NULL; CFy_Inv = NULL; CFz_Inv = NULL;
233  CoPx_Inv = NULL; CoPy_Inv = NULL; CoPz_Inv = NULL;
234  Cmu = NULL;
235 
236  CD_Mnt= NULL; CL_Mnt= NULL; CSF_Mnt= NULL; CEff_Mnt= NULL;
237  CMx_Mnt= NULL; CMy_Mnt= NULL; CMz_Mnt= NULL;
238  CFx_Mnt= NULL; CFy_Mnt= NULL; CFz_Mnt= NULL;
239  CoPx_Mnt= NULL; CoPy_Mnt= NULL; CoPz_Mnt= NULL;
240 
241  CPressure = NULL; CPressureTarget = NULL; HeatFlux = NULL; HeatFluxTarget = NULL; YPlus = NULL;
242  ForceInviscid = NULL; MomentInviscid = NULL;
243  ForceMomentum = NULL; MomentMomentum = NULL;
244 
245  /*--- Surface based array initialization ---*/
246 
247  Surface_CL_Inv = NULL; Surface_CD_Inv = NULL; Surface_CSF_Inv = NULL; Surface_CEff_Inv = NULL;
248  Surface_CFx_Inv = NULL; Surface_CFy_Inv = NULL; Surface_CFz_Inv = NULL;
249  Surface_CMx_Inv = NULL; Surface_CMy_Inv = NULL; Surface_CMz_Inv = NULL;
250  Surface_Cmu = NULL;
251 
253  Surface_CFx_Mnt= NULL; Surface_CFy_Mnt= NULL; Surface_CFz_Mnt= NULL;
254  Surface_CMx_Mnt= NULL; Surface_CMy_Mnt= NULL; Surface_CMz_Mnt = NULL;
255 
256  Surface_CL = NULL; Surface_CD = NULL; Surface_CSF = NULL; Surface_CEff = NULL;
257  Surface_CFx = NULL; Surface_CFy = NULL; Surface_CFz = NULL;
258  Surface_CMx = NULL; Surface_CMy = NULL; Surface_CMz = NULL;
259 
260  /*--- Rotorcraft simulation array initialization ---*/
261 
262  CMerit_Inv = NULL; CT_Inv = NULL; CQ_Inv = NULL;
263 
264  CMerit_Mnt = NULL; CT_Mnt = NULL; CQ_Mnt = NULL;
265 
266  /*--- Supersonic simulation array initialization ---*/
267 
268  CEquivArea_Inv = NULL;
269  CNearFieldOF_Inv = NULL;
270 
271  /*--- Engine simulation array initialization ---*/
272 
273  Inflow_MassFlow = NULL; Inflow_Pressure = NULL;
274  Inflow_Mach = NULL; Inflow_Area = NULL;
275  Exhaust_Pressure = NULL; Exhaust_Temperature = NULL;
276  Exhaust_MassFlow = NULL; Exhaust_Area = NULL;
277 
278  /*--- Numerical methods array initialization ---*/
279 
280  iPoint_UndLapl = NULL;
281  jPoint_UndLapl = NULL;
282  LowMach_Precontioner = NULL;
283  Primitive = NULL; Primitive_i = NULL; Primitive_j = NULL;
284  CharacPrimVar = NULL;
285  DonorPrimVar = NULL; DonorGlobalIndex = NULL;
286  ActDisk_DeltaP = NULL; ActDisk_DeltaT = NULL;
287 
288  Smatrix = NULL; Cvector = NULL;
289 
290  Secondary=NULL; Secondary_i=NULL; Secondary_j=NULL;
291 
292  /*--- Fixed CL mode initialization (cauchy criteria) ---*/
293 
294  Cauchy_Value = 0;
295  Cauchy_Func = 0;
296  Old_Func = 0;
297  New_Func = 0;
298  Cauchy_Counter = 0;
299  Cauchy_Serie = NULL;
300 
301  AoA_FD_Change = false;
302 
303  FluidModel = NULL;
304 
305  /*--- Initialize quantities for the average process for internal flow ---*/
306 
307  AverageVelocity = NULL;
308  AverageTurboVelocity = NULL;
311  AverageFlux = NULL;
312  SpanTotalFlux = NULL;
313  AveragePressure = NULL;
314  OldAveragePressure = NULL;
316  ExtAveragePressure = NULL;
317  AverageDensity = NULL;
318  OldAverageDensity = NULL;
319  ExtAverageDensity = NULL;
320  AverageNu = NULL;
321  AverageKine = NULL;
322  AverageOmega = NULL;
323  ExtAverageNu = NULL;
324  ExtAverageKine = NULL;
325  ExtAverageOmega = NULL;
326 
327 
328  /*--- Initialize primitive quantities for turboperformace ---*/
329 
330  DensityIn = NULL;
331  PressureIn = NULL;
332  TurboVelocityIn = NULL;
333  DensityOut = NULL;
334  PressureOut = NULL;
335  TurboVelocityOut = NULL;
336  KineIn = NULL;
337  OmegaIn = NULL;
338  NuIn = NULL;
339  KineOut = NULL;
340  OmegaOut = NULL;
341  NuOut = NULL;
342 
343 
344  /*--- Initialize quantities for Giles BC---*/
345 
346  CkInflow = NULL;
347  CkOutflow1 = NULL;
348  CkOutflow2 = NULL;
349 
350  /*--- Set the gamma value ---*/
351 
352  Gamma = config->GetGamma();
353  Gamma_Minus_One = Gamma - 1.0;
354 
355  /*--- Define geometry constants in the solver structure
356  Compressible flow, primitive variables (T, vx, vy, vz, P, rho, h, c, lamMu, EddyMu, ThCond, Cp).
357  ---*/
358 
359  nDim = geometry->GetnDim();
360 
361  nVar = nDim+2;
362  nPrimVar = nDim+9; nPrimVarGrad = nDim+4;
364 
365 
366  /*--- Initialize nVarGrad for deallocation ---*/
367 
369 
370  nMarker = config->GetnMarker_All();
371  nPoint = geometry->GetnPoint();
372  nPointDomain = geometry->GetnPointDomain();
373 
374  /*--- Store the number of vertices on each marker for deallocation later ---*/
375 
376  nVertex = new unsigned long[nMarker];
377  for (iMarker = 0; iMarker < nMarker; iMarker++)
378  nVertex[iMarker] = geometry->nVertex[iMarker];
379 
380  /*--- Perform the non-dimensionalization for the flow equations using the
381  specified reference values. ---*/
382 
383  SetNondimensionalization(config, iMesh);
384 
385  /*--- Allocate the node variables ---*/
386 
387  node = new CVariable*[nPoint];
388 
389  /*--- Define some auxiliary vectors related to the residual ---*/
390 
391  Residual = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0;
392  Residual_RMS = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_RMS[iVar] = 0.0;
393  Residual_Max = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_Max[iVar] = 0.0;
394  Residual_i = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_i[iVar] = 0.0;
395  Residual_j = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_j[iVar] = 0.0;
396  Res_Conv = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Res_Conv[iVar] = 0.0;
397  Res_Visc = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Res_Visc[iVar] = 0.0;
398  Res_Sour = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Res_Sour[iVar] = 0.0;
399 
400  /*--- Define some structures for locating max residuals ---*/
401 
402  Point_Max = new unsigned long[nVar]; for (iVar = 0; iVar < nVar; iVar++) Point_Max[iVar] = 0;
404  for (iVar = 0; iVar < nVar; iVar++) {
405  Point_Max_Coord[iVar] = new su2double[nDim];
406  for (iDim = 0; iDim < nDim; iDim++) Point_Max_Coord[iVar][iDim] = 0.0;
407  }
408 
409  /*--- Define some auxiliary vectors related to the solution ---*/
410 
411  Solution = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
412  Solution_i = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Solution_i[iVar] = 0.0;
413  Solution_j = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Solution_j[iVar] = 0.0;
414 
415  /*--- Define some auxiliary vectors related to the geometry ---*/
416 
417  Vector = new su2double[nDim]; for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = 0.0;
418  Vector_i = new su2double[nDim]; for (iDim = 0; iDim < nDim; iDim++) Vector_i[iDim] = 0.0;
419  Vector_j = new su2double[nDim]; for (iDim = 0; iDim < nDim; iDim++) Vector_j[iDim] = 0.0;
420 
421  /*--- Define some auxiliary vectors related to the primitive solution ---*/
422 
423  Primitive = new su2double[nPrimVar]; for (iVar = 0; iVar < nPrimVar; iVar++) Primitive[iVar] = 0.0;
424  Primitive_i = new su2double[nPrimVar]; for (iVar = 0; iVar < nPrimVar; iVar++) Primitive_i[iVar] = 0.0;
425  Primitive_j = new su2double[nPrimVar]; for (iVar = 0; iVar < nPrimVar; iVar++) Primitive_j[iVar] = 0.0;
426 
427  /*--- Define some auxiliary vectors related to the Secondary solution ---*/
428 
429  Secondary = new su2double[nSecondaryVar]; for (iVar = 0; iVar < nSecondaryVar; iVar++) Secondary[iVar] = 0.0;
430  Secondary_i = new su2double[nSecondaryVar]; for (iVar = 0; iVar < nSecondaryVar; iVar++) Secondary_i[iVar] = 0.0;
431  Secondary_j = new su2double[nSecondaryVar]; for (iVar = 0; iVar < nSecondaryVar; iVar++) Secondary_j[iVar] = 0.0;
432 
433  /*--- Define some auxiliary vectors related to the undivided lapalacian ---*/
434 
435  if (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) {
438  }
439 
440  /*--- Define some auxiliary vectors related to low-speed preconditioning ---*/
441 
442  if (roe_turkel || low_mach_prec) {
444  for (iVar = 0; iVar < nVar; iVar ++)
445  LowMach_Precontioner[iVar] = new su2double[nVar];
446  }
447 
448  /*--- Initialize the solution and right hand side vectors for storing
449  the residuals and updating the solution (always needed even for
450  explicit schemes). ---*/
451 
454 
455  /*--- Jacobians and vector structures for implicit computations ---*/
456 
457  if (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT) {
458 
459  Jacobian_i = new su2double* [nVar];
460  Jacobian_j = new su2double* [nVar];
461  for (iVar = 0; iVar < nVar; iVar++) {
462  Jacobian_i[iVar] = new su2double [nVar];
463  Jacobian_j[iVar] = new su2double [nVar];
464  }
465 
466  if (rank == MASTER_NODE) cout << "Initialize Jacobian structure (Euler). MG level: " << iMesh <<"." << endl;
467  Jacobian.Initialize(nPoint, nPointDomain, nVar, nVar, true, geometry, config);
468 
469  if ((config->GetKind_Linear_Solver_Prec() == LINELET) ||
470  (config->GetKind_Linear_Solver() == SMOOTHER_LINELET)) {
471  nLineLets = Jacobian.BuildLineletPreconditioner(geometry, config);
472  if (rank == MASTER_NODE) cout << "Compute linelet structure. " << nLineLets << " elements in each line (average)." << endl;
473  }
474 
475  }
476 
477  else {
478  if (rank == MASTER_NODE) cout << "Explicit scheme. No Jacobian structure (Euler). MG level: " << iMesh <<"." << endl;
479  }
480 
481  /*--- Define some auxiliary vectors for computing flow variable
482  gradients by least squares, S matrix := inv(R)*traspose(inv(R)),
483  c vector := transpose(WA)*(Wb) ---*/
484 
486 
487  Smatrix = new su2double* [nDim];
488  for (iDim = 0; iDim < nDim; iDim++)
489  Smatrix[iDim] = new su2double [nDim];
490 
491  Cvector = new su2double* [nPrimVarGrad];
492  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
493  Cvector[iVar] = new su2double [nDim];
494 
495  }
496 
497  /*--- Store the value of the characteristic primitive variables at the boundaries ---*/
498 
499  CharacPrimVar = new su2double** [nMarker];
500  for (iMarker = 0; iMarker < nMarker; iMarker++) {
501  CharacPrimVar[iMarker] = new su2double* [geometry->nVertex[iMarker]];
502  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
503  CharacPrimVar[iMarker][iVertex] = new su2double [nPrimVar];
504  for (iVar = 0; iVar < nPrimVar; iVar++) {
505  CharacPrimVar[iMarker][iVertex][iVar] = 0.0;
506  }
507  }
508  }
509 
510  /*--- Store the value of the primitive variables + 2 turb variables at the boundaries,
511  used for IO with a donor cell ---*/
512 
513  DonorPrimVar = new su2double** [nMarker];
514  for (iMarker = 0; iMarker < nMarker; iMarker++) {
515  DonorPrimVar[iMarker] = new su2double* [geometry->nVertex[iMarker]];
516  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
517  if (rans) {
518  DonorPrimVar[iMarker][iVertex] = new su2double [nPrimVar+2];
519  for (iVar = 0; iVar < nPrimVar + 2 ; iVar++) {
520  DonorPrimVar[iMarker][iVertex][iVar] = 0.0;
521  }
522  }
523  else {
524  DonorPrimVar[iMarker][iVertex] = new su2double [nPrimVar];
525  for (iVar = 0; iVar < nPrimVar ; iVar++) {
526  DonorPrimVar[iMarker][iVertex][iVar] = 0.0;
527  }
528  }
529  }
530  }
531 
532  /*--- Store the value of the characteristic primitive variables index at the boundaries ---*/
533 
534  DonorGlobalIndex = new unsigned long* [nMarker];
535  for (iMarker = 0; iMarker < nMarker; iMarker++) {
536  DonorGlobalIndex[iMarker] = new unsigned long [geometry->nVertex[iMarker]];
537  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
538  DonorGlobalIndex[iMarker][iVertex] = 0;
539  }
540  }
541 
542  /*--- Store the value of the Delta P at the Actuator Disk ---*/
543 
545  for (iMarker = 0; iMarker < nMarker; iMarker++) {
546  ActDisk_DeltaP[iMarker] = new su2double [geometry->nVertex[iMarker]];
547  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
548  ActDisk_DeltaP[iMarker][iVertex] = 0;
549  }
550  }
551 
552  /*--- Store the value of the Delta T at the Actuator Disk ---*/
553 
555  for (iMarker = 0; iMarker < nMarker; iMarker++) {
556  ActDisk_DeltaT[iMarker] = new su2double [geometry->nVertex[iMarker]];
557  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
558  ActDisk_DeltaT[iMarker][iVertex] = 0;
559  }
560  }
561 
562  /*--- Store the value of the Total Pressure at the inlet BC ---*/
563 
564  Inlet_Ttotal = new su2double* [nMarker];
565  for (iMarker = 0; iMarker < nMarker; iMarker++) {
566  Inlet_Ttotal[iMarker] = new su2double [geometry->nVertex[iMarker]];
567  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
568  Inlet_Ttotal[iMarker][iVertex] = 0;
569  }
570  }
571 
572  /*--- Store the value of the Total Temperature at the inlet BC ---*/
573 
574  Inlet_Ptotal = new su2double* [nMarker];
575  for (iMarker = 0; iMarker < nMarker; iMarker++) {
576  Inlet_Ptotal[iMarker] = new su2double [geometry->nVertex[iMarker]];
577  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
578  Inlet_Ptotal[iMarker][iVertex] = 0;
579  }
580  }
581 
582  /*--- Store the value of the Flow direction at the inlet BC ---*/
583 
584  Inlet_FlowDir = new su2double** [nMarker];
585  for (iMarker = 0; iMarker < nMarker; iMarker++) {
586  Inlet_FlowDir[iMarker] = new su2double* [geometry->nVertex[iMarker]];
587  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
588  Inlet_FlowDir[iMarker][iVertex] = new su2double [nDim];
589  for (iDim = 0; iDim < nDim; iDim++) {
590  Inlet_FlowDir[iMarker][iVertex][iDim] = 0;
591  }
592  }
593  }
594 
595  /*--- Force definition and coefficient arrays for all of the markers ---*/
596 
597  CPressure = new su2double* [nMarker];
599  for (iMarker = 0; iMarker < nMarker; iMarker++) {
600  CPressure[iMarker] = new su2double [geometry->nVertex[iMarker]];
601  CPressureTarget[iMarker] = new su2double [geometry->nVertex[iMarker]];
602  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
603  CPressure[iMarker][iVertex] = 0.0;
604  CPressureTarget[iMarker][iVertex] = 0.0;
605  }
606  }
607 
608  /*--- Non-dimensional coefficients ---*/
609 
611  MomentInviscid = new su2double[3];
612  CD_Inv = new su2double[nMarker];
613  CL_Inv = new su2double[nMarker];
614  CSF_Inv = new su2double[nMarker];
615  CMx_Inv = new su2double[nMarker];
616  CMy_Inv = new su2double[nMarker];
617  CMz_Inv = new su2double[nMarker];
618  CEff_Inv = new su2double[nMarker];
619  CFx_Inv = new su2double[nMarker];
620  CFy_Inv = new su2double[nMarker];
621  CFz_Inv = new su2double[nMarker];
622  CoPx_Inv = new su2double[nMarker];
623  CoPy_Inv = new su2double[nMarker];
624  CoPz_Inv = new su2double[nMarker];
625  Cmu = new su2double[nMarker];
626 
628  MomentMomentum = new su2double[3];
629  CD_Mnt = new su2double[nMarker];
630  CL_Mnt = new su2double[nMarker];
631  CSF_Mnt = new su2double[nMarker];
632  CMx_Mnt = new su2double[nMarker];
633  CMy_Mnt = new su2double[nMarker];
634  CMz_Mnt = new su2double[nMarker];
635  CEff_Mnt = new su2double[nMarker];
636  CFx_Mnt = new su2double[nMarker];
637  CFy_Mnt = new su2double[nMarker];
638  CFz_Mnt = new su2double[nMarker];
639  CoPx_Mnt = new su2double[nMarker];
640  CoPy_Mnt = new su2double[nMarker];
641  CoPz_Mnt = new su2double[nMarker];
642 
654 
665 
666  Surface_CL = new su2double[config->GetnMarker_Monitoring()];
667  Surface_CD = new su2double[config->GetnMarker_Monitoring()];
676 
677  /*--- Rotorcraft coefficients ---*/
678 
679  CT_Inv = new su2double[nMarker];
680  CQ_Inv = new su2double[nMarker];
682 
683  CT_Mnt = new su2double[nMarker];
684  CQ_Mnt = new su2double[nMarker];
686 
687  /*--- Supersonic coefficients ---*/
688 
691 
692  /*--- Engine simulation ---*/
693 
698 
703 
704  /*--- Init total coefficients ---*/
705 
706  Total_CD = 0.0; Total_CL = 0.0; Total_CSF = 0.0;
707  Total_CMx = 0.0; Total_CMy = 0.0; Total_CMz = 0.0;
708  Total_CoPx = 0.0; Total_CoPy = 0.0; Total_CoPz = 0.0;
709  Total_CEff = 0.0; Total_CEquivArea = 0.0; Total_CNearFieldOF = 0.0;
710  Total_CFx = 0.0; Total_CFy = 0.0; Total_CFz = 0.0;
711  Total_CT = 0.0; Total_CQ = 0.0; Total_CMerit = 0.0;
712  Total_MaxHeat = 0.0; Total_Heat = 0.0; Total_ComboObj = 0.0;
714  Total_NetThrust = 0.0;
715  Total_Power = 0.0; AoA_Prev = 0.0;
716  Total_CL_Prev = 0.0; Total_CD_Prev = 0.0;
717  Total_CMx_Prev = 0.0; Total_CMy_Prev = 0.0; Total_CMz_Prev = 0.0;
718  Total_AeroCD = 0.0; Total_SolidCD = 0.0; Total_IDR = 0.0; Total_IDC = 0.0;
719 
720  /*--- Read farfield conditions ---*/
721 
727  Mach_Inf = config->GetMach();
728 
729  /*--- Initialize the secondary values for direct derivative approxiations ---*/
730 
731  switch(direct_diff) {
732  case NO_DERIVATIVE:
733  /*--- Default ---*/
734  break;
735  case D_DENSITY:
737  break;
738  case D_PRESSURE:
740  break;
741  case D_TEMPERATURE:
743  break;
744  case D_MACH: case D_AOA:
745  case D_SIDESLIP: case D_REYNOLDS:
746  case D_TURB2LAM: case D_DESIGN:
747  /*--- Already done in postprocessing of config ---*/
748  break;
749  default:
750  break;
751  }
752 
753 
754  /*--- Initialize fan face pressure, fan face mach number, and mass flow rate ---*/
755 
756  for (iMarker = 0; iMarker < nMarker; iMarker++) {
757  Inflow_MassFlow[iMarker] = 0.0;
758  Inflow_Mach[iMarker] = Mach_Inf;
759  Inflow_Pressure[iMarker] = Pressure_Inf;
760  Inflow_Area[iMarker] = 0.0;
761 
762  Exhaust_MassFlow[iMarker] = 0.0;
764  Exhaust_Pressure[iMarker] = Pressure_Inf;
765  Exhaust_Area[iMarker] = 0.0;
766  }
767 
768  /*--- Initializate quantities for SlidingMesh Interface ---*/
769 
770  SlidingState = new su2double*** [nMarker];
771  SlidingStateNodes = new int* [nMarker];
772 
773  for (iMarker = 0; iMarker < nMarker; iMarker++){
774  SlidingState[iMarker] = NULL;
775  SlidingStateNodes[iMarker] = NULL;
776 
777  if (config->GetMarker_All_KindBC(iMarker) == FLUID_INTERFACE){
778 
779  SlidingState[iMarker] = new su2double**[geometry->GetnVertex(iMarker)];
780  SlidingStateNodes[iMarker] = new int [geometry->GetnVertex(iMarker)];
781 
782  for (iPoint = 0; iPoint < geometry->GetnVertex(iMarker); iPoint++){
783  SlidingState[iMarker][iPoint] = new su2double*[nPrimVar+1];
784 
785  SlidingStateNodes[iMarker][iPoint] = 0;
786  for (iVar = 0; iVar < nPrimVar+1; iVar++)
787  SlidingState[iMarker][iPoint][iVar] = NULL;
788  }
789 
790  }
791  }
792 
793  /*--- Initialize the solution to the far-field state everywhere. ---*/
794 
795  for (iPoint = 0; iPoint < nPoint; iPoint++)
796  node[iPoint] = new CEulerVariable(Density_Inf, Velocity_Inf, Energy_Inf, nDim, nVar, config);
797 
798  /*--- Check that the initial solution is physical, report any non-physical nodes ---*/
799 
800  counter_local = 0;
801 
802  for (iPoint = 0; iPoint < nPoint; iPoint++) {
803 
804  Density = node[iPoint]->GetSolution(0);
805 
806  Velocity2 = 0.0;
807  for (iDim = 0; iDim < nDim; iDim++)
808  Velocity2 += (node[iPoint]->GetSolution(iDim+1)/Density)*(node[iPoint]->GetSolution(iDim+1)/Density);
809 
810  StaticEnergy= node[iPoint]->GetSolution(nDim+1)/Density - 0.5*Velocity2;
811 
812  FluidModel->SetTDState_rhoe(Density, StaticEnergy);
813  Pressure= FluidModel->GetPressure();
814  Temperature= FluidModel->GetTemperature();
815 
816  /*--- Use the values at the infinity ---*/
817 
818  if ((Pressure < 0.0) || (Density < 0.0) || (Temperature < 0.0)) {
819  Solution[0] = Density_Inf;
820  for (iDim = 0; iDim < nDim; iDim++)
821  Solution[iDim+1] = Velocity_Inf[iDim]*Density_Inf;
823  node[iPoint]->SetSolution(Solution);
824  node[iPoint]->SetSolution_Old(Solution);
825  counter_local++;
826  }
827 
828  }
829 
830  /*--- Initialize the BGS residuals in FSI problems. ---*/
831  if (fsi){
832  Residual_BGS = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_BGS[iVar] = 0.0;
833  Residual_Max_BGS = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_Max_BGS[iVar] = 0.0;
834 
835  /*--- Define some structures for locating max residuals ---*/
836 
837  Point_Max_BGS = new unsigned long[nVar]; for (iVar = 0; iVar < nVar; iVar++) Point_Max_BGS[iVar] = 0;
839  for (iVar = 0; iVar < nVar; iVar++) {
840  Point_Max_Coord_BGS[iVar] = new su2double[nDim];
841  for (iDim = 0; iDim < nDim; iDim++) Point_Max_Coord_BGS[iVar][iDim] = 0.0;
842  }
843  }
844 
845  /*--- Initialize transpiration boundary velocity if necessary ---*/
846 
847  if(transp) SetTranspiration(geometry, config);
848 
849  /*--- Warning message about non-physical points ---*/
850 
851  if (config->GetConsole_Output_Verb() == VERB_HIGH) {
852 #ifdef HAVE_MPI
853  SU2_MPI::Reduce(&counter_local, &counter_global, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD);
854 #else
855  counter_global = counter_local;
856 #endif
857  if ((rank == MASTER_NODE) && (counter_global != 0))
858  cout << "Warning. The original solution contains "<< counter_global << " points that are not physical." << endl;
859  }
860 
861  /*--- Define solver parameters needed for execution of destructor ---*/
862 
863  if (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED ) space_centered = true;
864  else space_centered = false;
865 
867  else euler_implicit = false;
868 
870  else least_squares = false;
871 
872  /*--- Perform the MPI communication of the solution ---*/
873 
874  Set_MPI_Solution(geometry, config);
875 
876 }
877 
879 
880  unsigned short iVar, iMarker, iSpan;
881 
882  unsigned long iVertex;
883 
884  /*--- Array deallocation ---*/
885 
886  if (CD_Inv != NULL) delete [] CD_Inv;
887  if (CL_Inv != NULL) delete [] CL_Inv;
888  if (CSF_Inv != NULL) delete [] CSF_Inv;
889  if (CMx_Inv != NULL) delete [] CMx_Inv;
890  if (CMy_Inv != NULL) delete [] CMy_Inv;
891  if (CMz_Inv != NULL) delete [] CMz_Inv;
892  if (CFx_Inv != NULL) delete [] CFx_Inv;
893  if (CFy_Inv != NULL) delete [] CFy_Inv;
894  if (CFz_Inv != NULL) delete [] CFz_Inv;
895  if (CoPx_Inv != NULL) delete [] CoPx_Inv;
896  if (CoPy_Inv != NULL) delete [] CoPy_Inv;
897  if (CoPz_Inv != NULL) delete [] CoPz_Inv;
898  if (Cmu != NULL) delete [] Cmu;
899  if (Surface_CL_Inv != NULL) delete[] Surface_CL_Inv;
900  if (Surface_CD_Inv != NULL) delete[] Surface_CD_Inv;
901  if (Surface_CSF_Inv != NULL) delete[] Surface_CSF_Inv;
902  if (Surface_CEff_Inv != NULL) delete[] Surface_CEff_Inv;
903  if (Surface_CFx_Inv != NULL) delete [] Surface_CFx_Inv;
904  if (Surface_CFy_Inv != NULL) delete [] Surface_CFy_Inv;
905  if (Surface_CFz_Inv != NULL) delete [] Surface_CFz_Inv;
906  if (Surface_CMx_Inv != NULL) delete [] Surface_CMx_Inv;
907  if (Surface_CMy_Inv != NULL) delete [] Surface_CMy_Inv;
908  if (Surface_CMz_Inv != NULL) delete [] Surface_CMz_Inv;
909  if (Surface_Cmu != NULL) delete [] Surface_Cmu;
910 
911  if (CD_Mnt != NULL) delete [] CD_Mnt;
912  if (CL_Mnt != NULL) delete [] CL_Mnt;
913  if (CSF_Mnt != NULL) delete [] CSF_Mnt;
914  if (CFx_Mnt != NULL) delete [] CFx_Mnt;
915  if (CFy_Mnt != NULL) delete [] CFy_Mnt;
916  if (CFz_Mnt != NULL) delete [] CFz_Mnt;
917  if (CMx_Mnt != NULL) delete [] CMx_Mnt;
918  if (CMy_Mnt != NULL) delete [] CMy_Mnt;
919  if (CMz_Mnt != NULL) delete [] CMz_Mnt;
920  if (CoPx_Mnt != NULL) delete [] CoPx_Mnt;
921  if (CoPy_Mnt != NULL) delete [] CoPy_Mnt;
922  if (CoPz_Mnt != NULL) delete [] CoPz_Mnt;
923  if (Surface_CL_Mnt != NULL) delete[] Surface_CL_Mnt;
924  if (Surface_CD_Mnt != NULL) delete[] Surface_CD_Mnt;
925  if (Surface_CSF_Mnt != NULL) delete[] Surface_CSF_Mnt;
926  if (Surface_CEff_Mnt != NULL) delete[] Surface_CEff_Mnt;
927  if (Surface_CFx_Mnt != NULL) delete [] Surface_CFx_Mnt;
928  if (Surface_CFy_Mnt != NULL) delete [] Surface_CFy_Mnt;
929  if (Surface_CFz_Mnt != NULL) delete [] Surface_CFz_Mnt;
930  if (Surface_CMx_Mnt != NULL) delete [] Surface_CMx_Mnt;
931  if (Surface_CMy_Mnt != NULL) delete [] Surface_CMy_Mnt;
932  if (Surface_CMz_Mnt != NULL) delete [] Surface_CMz_Mnt;
933 
934  if (Surface_CL != NULL) delete [] Surface_CL;
935  if (Surface_CD != NULL) delete [] Surface_CD;
936  if (Surface_CSF != NULL) delete [] Surface_CSF;
937  if (Surface_CEff != NULL) delete [] Surface_CEff;
938  if (Surface_CFx != NULL) delete [] Surface_CFx;
939  if (Surface_CFy != NULL) delete [] Surface_CFy;
940  if (Surface_CFz != NULL) delete [] Surface_CFz;
941  if (Surface_CMx != NULL) delete [] Surface_CMx;
942  if (Surface_CMy != NULL) delete [] Surface_CMy;
943  if (Surface_CMz != NULL) delete [] Surface_CMz;
944  if (CEff_Inv != NULL) delete [] CEff_Inv;
945  if (CMerit_Inv != NULL) delete [] CMerit_Inv;
946  if (CT_Inv != NULL) delete [] CT_Inv;
947  if (CQ_Inv != NULL) delete [] CQ_Inv;
948  if (CEquivArea_Inv != NULL) delete [] CEquivArea_Inv;
949  if (CNearFieldOF_Inv != NULL) delete [] CNearFieldOF_Inv;
950 
951  if (CEff_Mnt != NULL) delete [] CEff_Mnt;
952  if (CMerit_Mnt != NULL) delete [] CMerit_Mnt;
953  if (CT_Mnt != NULL) delete [] CT_Mnt;
954  if (CQ_Mnt != NULL) delete [] CQ_Mnt;
955 
956  if (ForceInviscid != NULL) delete [] ForceInviscid;
957  if (MomentInviscid != NULL) delete [] MomentInviscid;
958  if (ForceMomentum != NULL) delete [] ForceMomentum;
959  if (MomentMomentum != NULL) delete [] MomentMomentum;
960  if (Inflow_MassFlow != NULL) delete [] Inflow_MassFlow;
961  if (Exhaust_MassFlow != NULL) delete [] Exhaust_MassFlow;
962  if (Exhaust_Area != NULL) delete [] Exhaust_Area;
963  if (Inflow_Pressure != NULL) delete [] Inflow_Pressure;
964  if (Inflow_Mach != NULL) delete [] Inflow_Mach;
965  if (Inflow_Area != NULL) delete [] Inflow_Area;
966 
967  if (Exhaust_Pressure != NULL) delete [] Exhaust_Pressure;
968  if (Exhaust_Temperature != NULL) delete [] Exhaust_Temperature;
969 
970  if (iPoint_UndLapl != NULL) delete [] iPoint_UndLapl;
971  if (jPoint_UndLapl != NULL) delete [] jPoint_UndLapl;
972 
973  if (Primitive != NULL) delete [] Primitive;
974  if (Primitive_i != NULL) delete [] Primitive_i;
975  if (Primitive_j != NULL) delete [] Primitive_j;
976 
977  if (Secondary != NULL) delete [] Secondary;
978  if (Secondary_i != NULL) delete [] Secondary_i;
979  if (Secondary_j != NULL) delete [] Secondary_j;
980 
981  if (LowMach_Precontioner != NULL) {
982  for (iVar = 0; iVar < nVar; iVar ++)
983  delete [] LowMach_Precontioner[iVar];
984  delete [] LowMach_Precontioner;
985  }
986 
987  if (CPressure != NULL) {
988  for (iMarker = 0; iMarker < nMarker; iMarker++)
989  delete [] CPressure[iMarker];
990  delete [] CPressure;
991  }
992 
993  if (CPressureTarget != NULL) {
994  for (iMarker = 0; iMarker < nMarker; iMarker++)
995  delete [] CPressureTarget[iMarker];
996  delete [] CPressureTarget;
997  }
998 
999  if (CharacPrimVar != NULL) {
1000  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1001  for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++)
1002  delete [] CharacPrimVar[iMarker][iVertex];
1003  delete [] CharacPrimVar[iMarker];
1004  }
1005  delete [] CharacPrimVar;
1006  }
1007 
1008  if (SlidingState != NULL) {
1009  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1010  if ( SlidingState[iMarker] != NULL ) {
1011  for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++)
1012  if ( SlidingState[iMarker][iVertex] != NULL ){
1013  for (iVar = 0; iVar < nPrimVar+1; iVar++)
1014  delete [] SlidingState[iMarker][iVertex][iVar];
1015  delete [] SlidingState[iMarker][iVertex];
1016  }
1017  delete [] SlidingState[iMarker];
1018  }
1019  }
1020  delete [] SlidingState;
1021  }
1022 
1023  if ( SlidingStateNodes != NULL ){
1024  for (iMarker = 0; iMarker < nMarker; iMarker++){
1025  if (SlidingStateNodes[iMarker] != NULL)
1026  delete [] SlidingStateNodes[iMarker];
1027  }
1028  delete [] SlidingStateNodes;
1029  }
1030 
1031  if (DonorPrimVar != NULL) {
1032  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1033  for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++)
1034  delete [] DonorPrimVar[iMarker][iVertex];
1035  delete [] DonorPrimVar[iMarker];
1036  }
1037  delete [] DonorPrimVar;
1038  }
1039 
1040  if (DonorGlobalIndex != NULL) {
1041  for (iMarker = 0; iMarker < nMarker; iMarker++)
1042  delete [] DonorGlobalIndex[iMarker];
1043  delete [] DonorGlobalIndex;
1044  }
1045 
1046  if (ActDisk_DeltaP != NULL) {
1047  for (iMarker = 0; iMarker < nMarker; iMarker++)
1048  delete [] ActDisk_DeltaP[iMarker];
1049  delete [] ActDisk_DeltaP;
1050  }
1051 
1052  if (ActDisk_DeltaT != NULL) {
1053  for (iMarker = 0; iMarker < nMarker; iMarker++)
1054  delete [] ActDisk_DeltaT[iMarker];
1055  delete [] ActDisk_DeltaT;
1056  }
1057 
1058  if (Inlet_Ttotal != NULL) {
1059  for (iMarker = 0; iMarker < nMarker; iMarker++)
1060  if (Inlet_Ttotal[iMarker] != NULL)
1061  delete [] Inlet_Ttotal[iMarker];
1062  delete [] Inlet_Ttotal;
1063  }
1064 
1065  if (Inlet_Ptotal != NULL) {
1066  for (iMarker = 0; iMarker < nMarker; iMarker++)
1067  if (Inlet_Ptotal[iMarker] != NULL)
1068  delete [] Inlet_Ptotal[iMarker];
1069  delete [] Inlet_Ptotal;
1070  }
1071 
1072  if (Inlet_FlowDir != NULL) {
1073  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1074  if (Inlet_FlowDir[iMarker] != NULL) {
1075  for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++)
1076  delete [] Inlet_FlowDir[iMarker][iVertex];
1077  delete [] Inlet_FlowDir[iMarker];
1078  }
1079  }
1080  delete [] Inlet_FlowDir;
1081  }
1082 
1083  if (nVertex != NULL) delete [] nVertex;
1084 
1085  if (HeatFlux != NULL) {
1086  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1087  delete [] HeatFlux[iMarker];
1088  }
1089  delete [] HeatFlux;
1090  }
1091 
1092  if (HeatFluxTarget != NULL) {
1093  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1094  delete [] HeatFluxTarget[iMarker];
1095  }
1096  delete [] HeatFluxTarget;
1097  }
1098 
1099  if (YPlus != NULL) {
1100  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1101  delete [] YPlus[iMarker];
1102  }
1103  delete [] YPlus;
1104  }
1105 
1106  if (Cauchy_Serie != NULL) delete [] Cauchy_Serie;
1107 
1108  if (FluidModel != NULL) delete FluidModel;
1109 
1110  if(AverageVelocity !=NULL){
1111  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1112  for(iSpan = 0; iSpan < nSpanWiseSections + 1; iSpan++)
1113  delete [] AverageVelocity[iMarker][iSpan];
1114  delete [] AverageVelocity[iMarker];
1115  }
1116  delete [] AverageVelocity;
1117  }
1118 
1119  if(AverageTurboVelocity !=NULL){
1120  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1121  for(iSpan = 0; iSpan < nSpanWiseSections + 1; iSpan++)
1122  delete [] AverageTurboVelocity[iMarker][iSpan];
1123  delete [] AverageTurboVelocity[iMarker];
1124  }
1125  delete [] AverageTurboVelocity;
1126  }
1127 
1128  if(OldAverageTurboVelocity != NULL){
1129  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1130  for(iSpan = 0; iSpan < nSpanWiseSections + 1; iSpan++)
1131  delete [] OldAverageTurboVelocity[iMarker][iSpan];
1132  delete [] OldAverageTurboVelocity[iMarker];
1133  }
1134  delete [] OldAverageTurboVelocity;
1135  }
1136 
1137  if(ExtAverageTurboVelocity !=NULL){
1138  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1139  for(iSpan = 0; iSpan < nSpanWiseSections + 1; iSpan++)
1140  delete [] ExtAverageTurboVelocity[iMarker][iSpan];
1141  delete [] ExtAverageTurboVelocity[iMarker];
1142  }
1143  delete [] ExtAverageTurboVelocity;
1144  }
1145 
1146 
1147  if(AverageFlux !=NULL){
1148  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1149  for(iSpan = 0; iSpan < nSpanWiseSections + 1; iSpan++)
1150  delete [] AverageFlux[iMarker][iSpan];
1151  delete [] AverageFlux[iMarker];
1152  }
1153  delete [] AverageFlux;
1154  }
1155 
1156  if(SpanTotalFlux !=NULL){
1157  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1158  for(iSpan = 0; iSpan < nSpanWiseSections + 1; iSpan++)
1159  delete [] SpanTotalFlux[iMarker][iSpan];
1160  delete [] SpanTotalFlux[iMarker];
1161  }
1162  delete [] SpanTotalFlux;
1163  }
1164 
1165  if(AveragePressure !=NULL){
1166  for (iMarker = 0; iMarker < nMarker; iMarker++)
1167  delete [] AveragePressure[iMarker];
1168  delete [] AveragePressure;
1169  }
1170 
1171  if(OldAveragePressure !=NULL){
1172  for (iMarker = 0; iMarker < nMarker; iMarker++)
1173  delete [] OldAveragePressure[iMarker];
1174  delete [] OldAveragePressure;
1175  }
1176 
1177  if(RadialEquilibriumPressure !=NULL){
1178  for (iMarker = 0; iMarker < nMarker; iMarker++)
1179  delete [] RadialEquilibriumPressure[iMarker];
1180  delete [] RadialEquilibriumPressure;
1181  }
1182 
1183  if(ExtAveragePressure !=NULL){
1184  for (iMarker = 0; iMarker < nMarker; iMarker++)
1185  delete [] ExtAveragePressure[iMarker];
1186  delete [] ExtAveragePressure;
1187  }
1188 
1189  if(AverageDensity !=NULL){
1190  for (iMarker = 0; iMarker < nMarker; iMarker++)
1191  delete [] AverageDensity[iMarker];
1192  delete [] AverageDensity;
1193  }
1194 
1195  if(OldAverageDensity !=NULL){
1196  for (iMarker = 0; iMarker < nMarker; iMarker++)
1197  delete [] OldAverageDensity[iMarker];
1198  delete [] OldAverageDensity;
1199  }
1200 
1201  if(ExtAverageDensity !=NULL){
1202  for (iMarker = 0; iMarker < nMarker; iMarker++)
1203  delete [] ExtAverageDensity[iMarker];
1204  delete [] ExtAverageDensity;
1205  }
1206 
1207  if(AverageKine !=NULL){
1208  for (iMarker = 0; iMarker < nMarker; iMarker++)
1209  delete [] AverageKine[iMarker];
1210  delete [] AverageKine;
1211  }
1212 
1213  if(AverageOmega !=NULL){
1214  for (iMarker = 0; iMarker < nMarker; iMarker++)
1215  delete [] AverageOmega[iMarker];
1216  delete [] AverageOmega;
1217  }
1218 
1219  if(AverageNu !=NULL){
1220  for (iMarker = 0; iMarker < nMarker; iMarker++)
1221  delete [] AverageNu[iMarker];
1222  delete [] AverageNu;
1223  }
1224 
1225  if(ExtAverageKine !=NULL){
1226  for (iMarker = 0; iMarker < nMarker; iMarker++)
1227  delete [] ExtAverageKine[iMarker];
1228  delete [] ExtAverageKine;
1229  }
1230 
1231  if(ExtAverageOmega !=NULL){
1232  for (iMarker = 0; iMarker < nMarker; iMarker++)
1233  delete [] ExtAverageOmega[iMarker];
1234  delete [] ExtAverageOmega;
1235  }
1236 
1237  if(ExtAverageNu !=NULL){
1238  for (iMarker = 0; iMarker < nMarker; iMarker++)
1239  delete [] ExtAverageNu[iMarker];
1240  delete [] ExtAverageNu;
1241  }
1242 
1243  if(TurboVelocityIn !=NULL){
1244  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++){
1245  for (iSpan = 0; iSpan < nSpanMax + 1; iSpan++){
1246  delete [] TurboVelocityIn[iMarker][iSpan];
1247  }
1248  delete [] TurboVelocityIn[iMarker];
1249  }
1250  delete [] TurboVelocityIn;
1251  }
1252 
1253  if(TurboVelocityOut !=NULL){
1254  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++){
1255  for (iSpan = 0; iSpan < nSpanMax + 1; iSpan++){
1256  delete [] TurboVelocityOut[iMarker][iSpan];
1257  }
1258  delete [] TurboVelocityOut[iMarker];
1259  }
1260  delete [] TurboVelocityOut;
1261  }
1262 
1263  if(DensityIn !=NULL){
1264  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++)
1265  delete [] DensityIn[iMarker];
1266  delete [] DensityIn;
1267  }
1268 
1269  if(PressureIn !=NULL){
1270  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++)
1271  delete [] PressureIn[iMarker];
1272  delete [] PressureIn;
1273  }
1274 
1275  if(DensityOut !=NULL){
1276  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++)
1277  delete [] DensityOut[iMarker];
1278  delete [] DensityOut;
1279  }
1280 
1281  if(PressureOut !=NULL){
1282  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++)
1283  delete [] PressureOut[iMarker];
1284  delete [] PressureOut;
1285  }
1286 
1287  if(KineIn !=NULL){
1288  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++)
1289  delete [] KineIn[iMarker];
1290  delete [] KineIn;
1291  }
1292 
1293  if(OmegaIn !=NULL){
1294  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++)
1295  delete [] OmegaIn[iMarker];
1296  delete [] OmegaIn;
1297  }
1298 
1299  if(NuIn !=NULL){
1300  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++)
1301  delete [] NuIn[iMarker];
1302  delete [] NuIn;
1303  }
1304 
1305  if(KineOut !=NULL){
1306  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++)
1307  delete [] KineOut[iMarker];
1308  delete [] KineOut;
1309  }
1310 
1311  if(OmegaOut !=NULL){
1312  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++)
1313  delete [] OmegaOut[iMarker];
1314  delete [] OmegaOut;
1315  }
1316 
1317  if(NuOut !=NULL){
1318  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++)
1319  delete [] NuOut[iMarker];
1320  delete [] NuOut;
1321  }
1322 
1323  if(CkInflow !=NULL){
1324  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1325  for(iSpan = 0; iSpan <nSpanWiseSections ; iSpan++)
1326  delete [] CkInflow[iMarker][iSpan];
1327  delete [] CkInflow[iMarker];
1328  }
1329  delete [] CkInflow;
1330  }
1331 
1332  if(CkOutflow1 !=NULL){
1333  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1334  for(iSpan = 0; iSpan <nSpanWiseSections ; iSpan++)
1335  delete [] CkOutflow1[iMarker][iSpan];
1336  delete [] CkOutflow1[iMarker];
1337  }
1338  delete [] CkOutflow1;
1339  }
1340 
1341  if(CkOutflow2 !=NULL){
1342  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1343  for(iSpan = 0; iSpan <nSpanWiseSections ; iSpan++)
1344  delete [] CkOutflow2[iMarker][iSpan];
1345  delete [] CkOutflow2[iMarker];
1346  }
1347  delete [] CkOutflow2;
1348  }
1349 
1350 }
1351 
1353  unsigned short iMarker, iSpan, iDim, iVar;
1354  nSpanMax = config->GetnSpanMaxAllZones();
1355 
1356 
1357  /*--- Initialize quantities for the average process for internal flow ---*/
1358 
1360 
1361  AverageVelocity = new su2double** [nMarker];
1365  AverageFlux = new su2double** [nMarker];
1366  SpanTotalFlux = new su2double** [nMarker];
1371  AverageDensity = new su2double* [nMarker];
1374  AverageNu = new su2double* [nMarker];
1375  AverageKine = new su2double* [nMarker];
1376  AverageOmega = new su2double* [nMarker];
1377  ExtAverageNu = new su2double* [nMarker];
1378  ExtAverageKine = new su2double* [nMarker];
1380 
1381  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1382  AverageVelocity[iMarker] = new su2double* [nSpanWiseSections + 1];
1383  AverageTurboVelocity[iMarker] = new su2double* [nSpanWiseSections + 1];
1384  OldAverageTurboVelocity[iMarker] = new su2double* [nSpanWiseSections + 1];
1385  ExtAverageTurboVelocity[iMarker] = new su2double* [nSpanWiseSections + 1];
1386  AverageFlux[iMarker] = new su2double* [nSpanWiseSections + 1];
1387  SpanTotalFlux[iMarker] = new su2double* [nSpanWiseSections + 1];
1388  AveragePressure[iMarker] = new su2double [nSpanWiseSections + 1];
1389  OldAveragePressure[iMarker] = new su2double [nSpanWiseSections + 1];
1391  ExtAveragePressure[iMarker] = new su2double [nSpanWiseSections + 1];
1392  AverageDensity[iMarker] = new su2double [nSpanWiseSections + 1];
1393  OldAverageDensity[iMarker] = new su2double [nSpanWiseSections + 1];
1394  ExtAverageDensity[iMarker] = new su2double [nSpanWiseSections + 1];
1395  AverageNu[iMarker] = new su2double [nSpanWiseSections + 1];
1396  AverageKine[iMarker] = new su2double [nSpanWiseSections + 1];
1397  AverageOmega[iMarker] = new su2double [nSpanWiseSections + 1];
1398  ExtAverageNu[iMarker] = new su2double [nSpanWiseSections + 1];
1399  ExtAverageKine[iMarker] = new su2double [nSpanWiseSections + 1];
1400  ExtAverageOmega[iMarker] = new su2double [nSpanWiseSections + 1];
1401 
1402  for(iSpan = 0; iSpan < nSpanWiseSections + 1; iSpan++){
1403  AverageVelocity[iMarker][iSpan] = new su2double [nDim];
1404  AverageTurboVelocity[iMarker][iSpan] = new su2double [nDim];
1405  OldAverageTurboVelocity[iMarker][iSpan] = new su2double [nDim];
1406  ExtAverageTurboVelocity[iMarker][iSpan] = new su2double [nDim];
1407  AverageFlux[iMarker][iSpan] = new su2double [nVar];
1408  SpanTotalFlux[iMarker][iSpan] = new su2double [nVar];
1409  AveragePressure[iMarker][iSpan] = 0.0;
1410  OldAveragePressure[iMarker][iSpan] = 0.0;
1411  RadialEquilibriumPressure[iMarker][iSpan] = 0.0;
1412  ExtAveragePressure[iMarker][iSpan] = 0.0;
1413  AverageDensity[iMarker][iSpan] = 0.0;
1414  OldAverageDensity[iMarker][iSpan] = 0.0;
1415  ExtAverageDensity[iMarker][iSpan] = 0.0;
1416  AverageNu[iMarker][iSpan] = 0.0;
1417  AverageKine[iMarker][iSpan] = 0.0;
1418  AverageOmega[iMarker][iSpan] = 0.0;
1419  ExtAverageNu[iMarker][iSpan] = 0.0;
1420  ExtAverageKine[iMarker][iSpan] = 0.0;
1421  ExtAverageOmega[iMarker][iSpan] = 0.0;
1422 
1423  for (iDim = 0; iDim < nDim; iDim++) {
1424  AverageVelocity[iMarker][iSpan][iDim] = 0.0;
1425  AverageTurboVelocity[iMarker][iSpan][iDim] = 0.0;
1426  OldAverageTurboVelocity[iMarker][iSpan][iDim] = 0.0;
1427  ExtAverageTurboVelocity[iMarker][iSpan][iDim] = 0.0;
1428  }
1429 
1430  for (iVar = 0; iVar < nVar; iVar++) {
1431  AverageFlux[iMarker][iSpan][iVar] = 0.0;
1432  SpanTotalFlux[iMarker][iSpan][iVar] = 0.0;
1433  }
1434  }
1435  }
1436 
1437 
1438  /*--- Initialize primitive quantities for turboperformace ---*/
1439 
1441 
1454 
1455  for (iMarker = 0; iMarker < nMarkerTurboPerf; iMarker++){
1456  DensityIn[iMarker] = new su2double [nSpanMax + 1];
1457  PressureIn[iMarker] = new su2double [nSpanMax + 1];
1458  TurboVelocityIn[iMarker] = new su2double*[nSpanMax + 1];
1459  DensityOut[iMarker] = new su2double [nSpanMax + 1];
1460  PressureOut[iMarker] = new su2double [nSpanMax + 1];
1461  TurboVelocityOut[iMarker] = new su2double*[nSpanMax + 1];
1462  KineIn[iMarker] = new su2double [nSpanMax + 1];
1463  OmegaIn[iMarker] = new su2double [nSpanMax + 1];
1464  NuIn[iMarker] = new su2double [nSpanMax + 1];
1465  KineOut[iMarker] = new su2double [nSpanMax + 1];
1466  OmegaOut[iMarker] = new su2double [nSpanMax + 1];
1467  NuOut[iMarker] = new su2double [nSpanMax + 1];
1468 
1469 
1470 
1471  for (iSpan = 0; iSpan < nSpanMax + 1; iSpan++){
1472  DensityIn[iMarker][iSpan] = 0.0;
1473  PressureIn[iMarker][iSpan] = 0.0;
1474  TurboVelocityIn[iMarker][iSpan] = new su2double[nDim];
1475  DensityOut[iMarker][iSpan] = 0.0;
1476  PressureOut[iMarker][iSpan] = 0.0;
1477  TurboVelocityOut [iMarker][iSpan] = new su2double[nDim];
1478  KineIn[iMarker][iSpan] = 0.0;
1479  OmegaIn[iMarker][iSpan] = 0.0;
1480  NuIn[iMarker][iSpan] = 0.0;
1481  KineOut[iMarker][iSpan] = 0.0;
1482  OmegaOut[iMarker][iSpan] = 0.0;
1483  NuOut[iMarker][iSpan] = 0.0;
1484 
1485  for (iDim = 0; iDim < nDim; iDim++){
1486  TurboVelocityIn [iMarker][iSpan][iDim] = 0.0;
1487  TurboVelocityOut [iMarker][iSpan][iDim] = 0.0;
1488  }
1489  }
1490  }
1491 
1492 
1493  /*--- Initialize quantities for NR BC ---*/
1494 
1495  if(config->GetBoolGiles()){
1496 
1497  CkInflow= new complex<su2double>** [nMarker];
1498  CkOutflow1= new complex<su2double>** [nMarker];
1499  CkOutflow2= new complex<su2double>** [nMarker];
1500 
1501  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1502  CkInflow[iMarker]= new complex<su2double>*[nSpanWiseSections];
1503  CkOutflow1[iMarker]= new complex<su2double>*[nSpanWiseSections];
1504  CkOutflow2[iMarker]= new complex<su2double>*[nSpanWiseSections];
1505 
1506  for(iSpan = 0; iSpan < nSpanWiseSections; iSpan++) {
1507  CkInflow[iMarker][iSpan]= new complex<su2double>[2*geometry->GetnFreqSpanMax(INFLOW)+1];
1508  CkOutflow1[iMarker][iSpan]= new complex<su2double>[2*geometry->GetnFreqSpanMax(OUTFLOW)+1];
1509  CkOutflow2[iMarker][iSpan]= new complex<su2double>[2*geometry->GetnFreqSpanMax(OUTFLOW)+1];
1510 
1511  for (iVar = 0; iVar <2*geometry->GetnFreqSpanMax(INFLOW)+1; iVar++) {
1512  CkInflow[iMarker][iSpan][iVar]= complex<su2double>(0.0,0.0);
1513  }
1514 
1515  for (iVar = 0; iVar <2*geometry->GetnFreqSpanMax(OUTFLOW)+1; iVar++) {
1516  CkOutflow1[iMarker][iSpan][iVar]= complex<su2double>(0.0,0.0);
1517  CkOutflow2[iMarker][iSpan][iVar]= complex<su2double>(0.0,0.0);
1518  }
1519  }
1520  }
1521  }
1522 
1523 
1524 }
1525 
1527  unsigned short iVar, iMarker, iPeriodic_Index, MarkerS, MarkerR;
1528  unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
1529  su2double rotMatrix[3][3], *angles, theta, cosTheta, sinTheta, phi, cosPhi, sinPhi, psi, cosPsi, sinPsi, *Buffer_Receive_U = NULL, *Buffer_Send_U = NULL;
1530 
1531 #ifdef HAVE_MPI
1532  int send_to, receive_from;
1533  SU2_MPI::Status status;
1534 #endif
1535 
1536  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1537 
1538  if ((config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) &&
1539  (config->GetMarker_All_SendRecv(iMarker) > 0)) {
1540 
1541  MarkerS = iMarker; MarkerR = iMarker+1;
1542 
1543 #ifdef HAVE_MPI
1544  send_to = config->GetMarker_All_SendRecv(MarkerS)-1;
1545  receive_from = abs(config->GetMarker_All_SendRecv(MarkerR))-1;
1546 #endif
1547 
1548  nVertexS = geometry->nVertex[MarkerS]; nVertexR = geometry->nVertex[MarkerR];
1549  nBufferS_Vector = nVertexS*nVar; nBufferR_Vector = nVertexR*nVar;
1550 
1551  /*--- Allocate Receive and send buffers ---*/
1552  Buffer_Receive_U = new su2double [nBufferR_Vector];
1553  Buffer_Send_U = new su2double[nBufferS_Vector];
1554 
1555  /*--- Copy the solution that should be sended ---*/
1556  for (iVertex = 0; iVertex < nVertexS; iVertex++) {
1557  iPoint = geometry->vertex[MarkerS][iVertex]->GetNode();
1558  for (iVar = 0; iVar < nVar; iVar++)
1559  Buffer_Send_U[iVar*nVertexS+iVertex] = node[iPoint]->GetSolution(iVar);
1560  }
1561 
1562 #ifdef HAVE_MPI
1563 
1564  /*--- Send/Receive information using Sendrecv ---*/
1565  SU2_MPI::Sendrecv(Buffer_Send_U, nBufferS_Vector, MPI_DOUBLE, send_to, 0,
1566  Buffer_Receive_U, nBufferR_Vector, MPI_DOUBLE, receive_from, 0, MPI_COMM_WORLD, &status);
1567 
1568 #else
1569 
1570  /*--- Receive information without MPI ---*/
1571  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
1572  for (iVar = 0; iVar < nVar; iVar++)
1573  Buffer_Receive_U[iVar*nVertexR+iVertex] = Buffer_Send_U[iVar*nVertexR+iVertex];
1574  }
1575 
1576 #endif
1577 
1578  /*--- Deallocate send buffer ---*/
1579  delete [] Buffer_Send_U;
1580 
1581  /*--- Do the coordinate transformation ---*/
1582  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
1583 
1584  /*--- Find point and its type of transformation ---*/
1585  iPoint = geometry->vertex[MarkerR][iVertex]->GetNode();
1586  iPeriodic_Index = geometry->vertex[MarkerR][iVertex]->GetRotation_Type();
1587 
1588  /*--- Retrieve the supplied periodic information. ---*/
1589  angles = config->GetPeriodicRotation(iPeriodic_Index);
1590 
1591  /*--- Store angles separately for clarity. ---*/
1592  theta = angles[0]; phi = angles[1]; psi = angles[2];
1593  cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
1594  sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
1595 
1596  /*--- Compute the rotation matrix. Note that the implicit
1597  ordering is rotation about the x-axis, y-axis,
1598  then z-axis. Note that this is the transpose of the matrix
1599  used during the preprocessing stage. ---*/
1600  rotMatrix[0][0] = cosPhi*cosPsi; rotMatrix[1][0] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi; rotMatrix[2][0] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
1601  rotMatrix[0][1] = cosPhi*sinPsi; rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi; rotMatrix[2][1] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
1602  rotMatrix[0][2] = -sinPhi; rotMatrix[1][2] = sinTheta*cosPhi; rotMatrix[2][2] = cosTheta*cosPhi;
1603 
1604  /*--- Copy conserved variables before performing transformation. ---*/
1605  for (iVar = 0; iVar < nVar; iVar++)
1606  Solution[iVar] = Buffer_Receive_U[iVar*nVertexR+iVertex];
1607 
1608  /*--- Rotate the momentum components. ---*/
1609  if (nDim == 2) {
1610  Solution[1] = rotMatrix[0][0]*Buffer_Receive_U[1*nVertexR+iVertex] +
1611  rotMatrix[0][1]*Buffer_Receive_U[2*nVertexR+iVertex];
1612  Solution[2] = rotMatrix[1][0]*Buffer_Receive_U[1*nVertexR+iVertex] +
1613  rotMatrix[1][1]*Buffer_Receive_U[2*nVertexR+iVertex];
1614  }
1615  else {
1616  Solution[1] = rotMatrix[0][0]*Buffer_Receive_U[1*nVertexR+iVertex] +
1617  rotMatrix[0][1]*Buffer_Receive_U[2*nVertexR+iVertex] +
1618  rotMatrix[0][2]*Buffer_Receive_U[3*nVertexR+iVertex];
1619  Solution[2] = rotMatrix[1][0]*Buffer_Receive_U[1*nVertexR+iVertex] +
1620  rotMatrix[1][1]*Buffer_Receive_U[2*nVertexR+iVertex] +
1621  rotMatrix[1][2]*Buffer_Receive_U[3*nVertexR+iVertex];
1622  Solution[3] = rotMatrix[2][0]*Buffer_Receive_U[1*nVertexR+iVertex] +
1623  rotMatrix[2][1]*Buffer_Receive_U[2*nVertexR+iVertex] +
1624  rotMatrix[2][2]*Buffer_Receive_U[3*nVertexR+iVertex];
1625  }
1626 
1627  /*--- Copy transformed conserved variables back into buffer. ---*/
1628  for (iVar = 0; iVar < nVar; iVar++)
1629  node[iPoint]->SetSolution(iVar, Solution[iVar]);
1630 
1631  }
1632 
1633  /*--- Deallocate receive buffer ---*/
1634  delete [] Buffer_Receive_U;
1635 
1636  }
1637 
1638  }
1639 
1640 }
1641 
1643  unsigned short iVar, iMarker, iPeriodic_Index, MarkerS, MarkerR;
1644  unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
1645  su2double rotMatrix[3][3], *angles, theta, cosTheta, sinTheta, phi, cosPhi, sinPhi, psi, cosPsi, sinPsi,
1646  *Buffer_Receive_U = NULL, *Buffer_Send_U = NULL;
1647 
1648 #ifdef HAVE_MPI
1649  int send_to, receive_from;
1650  SU2_MPI::Status status;
1651 #endif
1652 
1653  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1654 
1655  if ((config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) &&
1656  (config->GetMarker_All_SendRecv(iMarker) > 0)) {
1657 
1658  MarkerS = iMarker; MarkerR = iMarker+1;
1659 
1660 #ifdef HAVE_MPI
1661  send_to = config->GetMarker_All_SendRecv(MarkerS)-1;
1662  receive_from = abs(config->GetMarker_All_SendRecv(MarkerR))-1;
1663 #endif
1664 
1665  nVertexS = geometry->nVertex[MarkerS]; nVertexR = geometry->nVertex[MarkerR];
1666  nBufferS_Vector = nVertexS*nVar; nBufferR_Vector = nVertexR*nVar;
1667 
1668  /*--- Allocate Receive and send buffers ---*/
1669  Buffer_Receive_U = new su2double [nBufferR_Vector];
1670  Buffer_Send_U = new su2double[nBufferS_Vector];
1671 
1672  /*--- Copy the solution old that should be sended ---*/
1673  for (iVertex = 0; iVertex < nVertexS; iVertex++) {
1674  iPoint = geometry->vertex[MarkerS][iVertex]->GetNode();
1675  for (iVar = 0; iVar < nVar; iVar++)
1676  Buffer_Send_U[iVar*nVertexS+iVertex] = node[iPoint]->GetSolution_Old(iVar);
1677  }
1678 
1679 #ifdef HAVE_MPI
1680 
1681  /*--- Send/Receive information using Sendrecv ---*/
1682  SU2_MPI::Sendrecv(Buffer_Send_U, nBufferS_Vector, MPI_DOUBLE, send_to, 0,
1683  Buffer_Receive_U, nBufferR_Vector, MPI_DOUBLE, receive_from, 0, MPI_COMM_WORLD, &status);
1684 
1685 #else
1686 
1687  /*--- Receive information without MPI ---*/
1688  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
1689  for (iVar = 0; iVar < nVar; iVar++)
1690  Buffer_Receive_U[iVar*nVertexR+iVertex] = Buffer_Send_U[iVar*nVertexR+iVertex];
1691  }
1692 
1693 #endif
1694 
1695  /*--- Deallocate send buffer ---*/
1696  delete [] Buffer_Send_U;
1697 
1698  /*--- Do the coordinate transformation ---*/
1699  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
1700 
1701  /*--- Find point and its type of transformation ---*/
1702  iPoint = geometry->vertex[MarkerR][iVertex]->GetNode();
1703  iPeriodic_Index = geometry->vertex[MarkerR][iVertex]->GetRotation_Type();
1704 
1705  /*--- Retrieve the supplied periodic information. ---*/
1706  angles = config->GetPeriodicRotation(iPeriodic_Index);
1707 
1708  /*--- Store angles separately for clarity. ---*/
1709  theta = angles[0]; phi = angles[1]; psi = angles[2];
1710  cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
1711  sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
1712 
1713  /*--- Compute the rotation matrix. Note that the implicit
1714  ordering is rotation about the x-axis, y-axis,
1715  then z-axis. Note that this is the transpose of the matrix
1716  used during the preprocessing stage. ---*/
1717  rotMatrix[0][0] = cosPhi*cosPsi; rotMatrix[1][0] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi; rotMatrix[2][0] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
1718  rotMatrix[0][1] = cosPhi*sinPsi; rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi; rotMatrix[2][1] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
1719  rotMatrix[0][2] = -sinPhi; rotMatrix[1][2] = sinTheta*cosPhi; rotMatrix[2][2] = cosTheta*cosPhi;
1720 
1721  /*--- Copy conserved variables before performing transformation. ---*/
1722  for (iVar = 0; iVar < nVar; iVar++)
1723  Solution[iVar] = Buffer_Receive_U[iVar*nVertexR+iVertex];
1724 
1725  /*--- Rotate the momentum components. ---*/
1726  if (nDim == 2) {
1727  Solution[1] = rotMatrix[0][0]*Buffer_Receive_U[1*nVertexR+iVertex] +
1728  rotMatrix[0][1]*Buffer_Receive_U[2*nVertexR+iVertex];
1729  Solution[2] = rotMatrix[1][0]*Buffer_Receive_U[1*nVertexR+iVertex] +
1730  rotMatrix[1][1]*Buffer_Receive_U[2*nVertexR+iVertex];
1731  }
1732  else {
1733  Solution[1] = rotMatrix[0][0]*Buffer_Receive_U[1*nVertexR+iVertex] +
1734  rotMatrix[0][1]*Buffer_Receive_U[2*nVertexR+iVertex] +
1735  rotMatrix[0][2]*Buffer_Receive_U[3*nVertexR+iVertex];
1736  Solution[2] = rotMatrix[1][0]*Buffer_Receive_U[1*nVertexR+iVertex] +
1737  rotMatrix[1][1]*Buffer_Receive_U[2*nVertexR+iVertex] +
1738  rotMatrix[1][2]*Buffer_Receive_U[3*nVertexR+iVertex];
1739  Solution[3] = rotMatrix[2][0]*Buffer_Receive_U[1*nVertexR+iVertex] +
1740  rotMatrix[2][1]*Buffer_Receive_U[2*nVertexR+iVertex] +
1741  rotMatrix[2][2]*Buffer_Receive_U[3*nVertexR+iVertex];
1742  }
1743 
1744  /*--- Copy transformed conserved variables back into buffer. ---*/
1745  for (iVar = 0; iVar < nVar; iVar++)
1746  node[iPoint]->SetSolution_Old(iVar, Solution[iVar]);
1747 
1748  }
1749 
1750  /*--- Deallocate receive buffer ---*/
1751  delete [] Buffer_Receive_U;
1752 
1753  }
1754 
1755  }
1756 }
1757 
1759  unsigned short iVar, iMarker, iPeriodic_Index, MarkerS, MarkerR;
1760  unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
1761  su2double rotMatrix[3][3], *angles, theta, cosTheta, sinTheta, phi, cosPhi, sinPhi, psi, cosPsi, sinPsi,
1762  *Buffer_Receive_Undivided_Laplacian = NULL, *Buffer_Send_Undivided_Laplacian = NULL;
1763 
1764 #ifdef HAVE_MPI
1765  int send_to, receive_from;
1766  SU2_MPI::Status status;
1767 #endif
1768 
1769  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1770 
1771  if ((config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) &&
1772  (config->GetMarker_All_SendRecv(iMarker) > 0)) {
1773 
1774  MarkerS = iMarker; MarkerR = iMarker+1;
1775 
1776 #ifdef HAVE_MPI
1777  send_to = config->GetMarker_All_SendRecv(MarkerS)-1;
1778  receive_from = abs(config->GetMarker_All_SendRecv(MarkerR))-1;
1779 #endif
1780 
1781  nVertexS = geometry->nVertex[MarkerS]; nVertexR = geometry->nVertex[MarkerR];
1782  nBufferS_Vector = nVertexS*nVar; nBufferR_Vector = nVertexR*nVar;
1783 
1784  /*--- Allocate Receive and send buffers ---*/
1785  Buffer_Receive_Undivided_Laplacian = new su2double [nBufferR_Vector];
1786  Buffer_Send_Undivided_Laplacian = new su2double[nBufferS_Vector];
1787 
1788  /*--- Copy the solution old that should be sended ---*/
1789  for (iVertex = 0; iVertex < nVertexS; iVertex++) {
1790  iPoint = geometry->vertex[MarkerS][iVertex]->GetNode();
1791  for (iVar = 0; iVar < nVar; iVar++)
1792  Buffer_Send_Undivided_Laplacian[iVar*nVertexS+iVertex] = node[iPoint]->GetUndivided_Laplacian(iVar);
1793  }
1794 
1795 #ifdef HAVE_MPI
1796 
1797  /*--- Send/Receive information using Sendrecv ---*/
1798  SU2_MPI::Sendrecv(Buffer_Send_Undivided_Laplacian, nBufferS_Vector, MPI_DOUBLE, send_to, 0,
1799  Buffer_Receive_Undivided_Laplacian, nBufferR_Vector, MPI_DOUBLE, receive_from, 0, MPI_COMM_WORLD, &status);
1800 
1801 #else
1802 
1803  /*--- Receive information without MPI ---*/
1804  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
1805  for (iVar = 0; iVar < nVar; iVar++)
1806  Buffer_Receive_Undivided_Laplacian[iVar*nVertexR+iVertex] = Buffer_Send_Undivided_Laplacian[iVar*nVertexR+iVertex];
1807  }
1808 
1809 #endif
1810 
1811  /*--- Deallocate send buffer ---*/
1812  delete [] Buffer_Send_Undivided_Laplacian;
1813 
1814  /*--- Do the coordinate transformation ---*/
1815  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
1816 
1817  /*--- Find point and its type of transformation ---*/
1818  iPoint = geometry->vertex[MarkerR][iVertex]->GetNode();
1819  iPeriodic_Index = geometry->vertex[MarkerR][iVertex]->GetRotation_Type();
1820 
1821  /*--- Retrieve the supplied periodic information. ---*/
1822  angles = config->GetPeriodicRotation(iPeriodic_Index);
1823 
1824  /*--- Store angles separately for clarity. ---*/
1825  theta = angles[0]; phi = angles[1]; psi = angles[2];
1826  cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
1827  sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
1828 
1829  /*--- Compute the rotation matrix. Note that the implicit
1830  ordering is rotation about the x-axis, y-axis,
1831  then z-axis. Note that this is the transpose of the matrix
1832  used during the preprocessing stage. ---*/
1833  rotMatrix[0][0] = cosPhi*cosPsi; rotMatrix[1][0] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi; rotMatrix[2][0] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
1834  rotMatrix[0][1] = cosPhi*sinPsi; rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi; rotMatrix[2][1] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
1835  rotMatrix[0][2] = -sinPhi; rotMatrix[1][2] = sinTheta*cosPhi; rotMatrix[2][2] = cosTheta*cosPhi;
1836 
1837  /*--- Copy conserved variables before performing transformation. ---*/
1838  for (iVar = 0; iVar < nVar; iVar++)
1839  Solution[iVar] = Buffer_Receive_Undivided_Laplacian[iVar*nVertexR+iVertex];
1840 
1841  /*--- Rotate the momentum components. ---*/
1842  if (nDim == 2) {
1843  Solution[1] = rotMatrix[0][0]*Buffer_Receive_Undivided_Laplacian[1*nVertexR+iVertex] +
1844  rotMatrix[0][1]*Buffer_Receive_Undivided_Laplacian[2*nVertexR+iVertex];
1845  Solution[2] = rotMatrix[1][0]*Buffer_Receive_Undivided_Laplacian[1*nVertexR+iVertex] +
1846  rotMatrix[1][1]*Buffer_Receive_Undivided_Laplacian[2*nVertexR+iVertex];
1847  }
1848  else {
1849  Solution[1] = rotMatrix[0][0]*Buffer_Receive_Undivided_Laplacian[1*nVertexR+iVertex] +
1850  rotMatrix[0][1]*Buffer_Receive_Undivided_Laplacian[2*nVertexR+iVertex] +
1851  rotMatrix[0][2]*Buffer_Receive_Undivided_Laplacian[3*nVertexR+iVertex];
1852  Solution[2] = rotMatrix[1][0]*Buffer_Receive_Undivided_Laplacian[1*nVertexR+iVertex] +
1853  rotMatrix[1][1]*Buffer_Receive_Undivided_Laplacian[2*nVertexR+iVertex] +
1854  rotMatrix[1][2]*Buffer_Receive_Undivided_Laplacian[3*nVertexR+iVertex];
1855  Solution[3] = rotMatrix[2][0]*Buffer_Receive_Undivided_Laplacian[1*nVertexR+iVertex] +
1856  rotMatrix[2][1]*Buffer_Receive_Undivided_Laplacian[2*nVertexR+iVertex] +
1857  rotMatrix[2][2]*Buffer_Receive_Undivided_Laplacian[3*nVertexR+iVertex];
1858  }
1859 
1860  /*--- Copy transformed conserved variables back into buffer. ---*/
1861  for (iVar = 0; iVar < nVar; iVar++)
1862  node[iPoint]->SetUndivided_Laplacian(iVar, Solution[iVar]);
1863 
1864  }
1865 
1866  /*--- Deallocate receive buffer ---*/
1867  delete [] Buffer_Receive_Undivided_Laplacian;
1868 
1869  }
1870 
1871  }
1872 
1873 }
1874 
1876  unsigned short iMarker, MarkerS, MarkerR, *Buffer_Receive_Neighbor = NULL, *Buffer_Send_Neighbor = NULL;
1877  unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
1878  su2double *Buffer_Receive_Lambda = NULL, *Buffer_Send_Lambda = NULL;
1879 
1880 #ifdef HAVE_MPI
1881  int send_to, receive_from;
1882  SU2_MPI::Status status;
1883 #endif
1884 
1885  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1886 
1887  if ((config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) &&
1888  (config->GetMarker_All_SendRecv(iMarker) > 0)) {
1889 
1890  MarkerS = iMarker; MarkerR = iMarker+1;
1891 
1892 #ifdef HAVE_MPI
1893  send_to = config->GetMarker_All_SendRecv(MarkerS)-1;
1894  receive_from = abs(config->GetMarker_All_SendRecv(MarkerR))-1;
1895 #endif
1896 
1897  nVertexS = geometry->nVertex[MarkerS]; nVertexR = geometry->nVertex[MarkerR];
1898  nBufferS_Vector = nVertexS; nBufferR_Vector = nVertexR;
1899 
1900  /*--- Allocate Receive and send buffers ---*/
1901  Buffer_Receive_Lambda = new su2double [nBufferR_Vector];
1902  Buffer_Send_Lambda = new su2double[nBufferS_Vector];
1903  Buffer_Receive_Neighbor = new unsigned short [nBufferR_Vector];
1904  Buffer_Send_Neighbor = new unsigned short[nBufferS_Vector];
1905 
1906  /*--- Copy the solution old that should be sended ---*/
1907  for (iVertex = 0; iVertex < nVertexS; iVertex++) {
1908  iPoint = geometry->vertex[MarkerS][iVertex]->GetNode();
1909  Buffer_Send_Lambda[iVertex] = node[iPoint]->GetLambda();
1910  Buffer_Send_Neighbor[iVertex] = geometry->node[iPoint]->GetnPoint();
1911  }
1912 
1913 #ifdef HAVE_MPI
1914 
1915  /*--- Send/Receive information using Sendrecv ---*/
1916  SU2_MPI::Sendrecv(Buffer_Send_Lambda, nBufferS_Vector, MPI_DOUBLE, send_to, 0,
1917  Buffer_Receive_Lambda, nBufferR_Vector, MPI_DOUBLE, receive_from, 0, MPI_COMM_WORLD, &status);
1918  SU2_MPI::Sendrecv(Buffer_Send_Neighbor, nBufferS_Vector, MPI_UNSIGNED_SHORT, send_to, 1,
1919  Buffer_Receive_Neighbor, nBufferR_Vector, MPI_UNSIGNED_SHORT, receive_from, 1, MPI_COMM_WORLD, &status);
1920 
1921 #else
1922 
1923  /*--- Receive information without MPI ---*/
1924  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
1925  Buffer_Receive_Lambda[iVertex] = Buffer_Send_Lambda[iVertex];
1926  Buffer_Receive_Neighbor[iVertex] = Buffer_Send_Neighbor[iVertex];
1927  }
1928 
1929 #endif
1930 
1931  /*--- Deallocate send buffer ---*/
1932  delete [] Buffer_Send_Lambda;
1933  delete [] Buffer_Send_Neighbor;
1934 
1935  /*--- Do the coordinate transformation ---*/
1936  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
1937 
1938  /*--- Find point and its type of transformation ---*/
1939  iPoint = geometry->vertex[MarkerR][iVertex]->GetNode();
1940  node[iPoint]->SetLambda(Buffer_Receive_Lambda[iVertex]);
1941  geometry->node[iPoint]->SetnNeighbor(Buffer_Receive_Neighbor[iVertex]);
1942 
1943  }
1944 
1945  /*--- Deallocate receive buffer ---*/
1946  delete [] Buffer_Receive_Lambda;
1947  delete [] Buffer_Receive_Neighbor;
1948 
1949  }
1950 
1951  }
1952 }
1953 
1955  unsigned short iMarker, MarkerS, MarkerR;
1956  unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
1957  su2double *Buffer_Receive_Lambda = NULL, *Buffer_Send_Lambda = NULL;
1958 
1959 #ifdef HAVE_MPI
1960  int send_to, receive_from;
1961  SU2_MPI::Status status;
1962 #endif
1963 
1964  for (iMarker = 0; iMarker < nMarker; iMarker++) {
1965 
1966  if ((config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) &&
1967  (config->GetMarker_All_SendRecv(iMarker) > 0)) {
1968 
1969  MarkerS = iMarker; MarkerR = iMarker+1;
1970 
1971 #ifdef HAVE_MPI
1972  send_to = config->GetMarker_All_SendRecv(MarkerS)-1;
1973  receive_from = abs(config->GetMarker_All_SendRecv(MarkerR))-1;
1974 #endif
1975 
1976  nVertexS = geometry->nVertex[MarkerS]; nVertexR = geometry->nVertex[MarkerR];
1977  nBufferS_Vector = nVertexS; nBufferR_Vector = nVertexR;
1978 
1979  /*--- Allocate Receive and send buffers ---*/
1980  Buffer_Receive_Lambda = new su2double [nBufferR_Vector];
1981  Buffer_Send_Lambda = new su2double[nBufferS_Vector];
1982 
1983  /*--- Copy the solution old that should be sended ---*/
1984  for (iVertex = 0; iVertex < nVertexS; iVertex++) {
1985  iPoint = geometry->vertex[MarkerS][iVertex]->GetNode();
1986  Buffer_Send_Lambda[iVertex] = node[iPoint]->GetSensor();
1987  }
1988 
1989 #ifdef HAVE_MPI
1990 
1991  /*--- Send/Receive information using Sendrecv ---*/
1992  SU2_MPI::Sendrecv(Buffer_Send_Lambda, nBufferS_Vector, MPI_DOUBLE, send_to, 0,
1993  Buffer_Receive_Lambda, nBufferR_Vector, MPI_DOUBLE, receive_from, 0, MPI_COMM_WORLD, &status);
1994 
1995 #else
1996 
1997  /*--- Receive information without MPI ---*/
1998  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
1999  Buffer_Receive_Lambda[iVertex] = Buffer_Send_Lambda[iVertex];
2000  }
2001 
2002 #endif
2003 
2004  /*--- Deallocate send buffer ---*/
2005  delete [] Buffer_Send_Lambda;
2006 
2007  /*--- Do the coordinate transformation ---*/
2008  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
2009 
2010  /*--- Find point and its type of transformation ---*/
2011  iPoint = geometry->vertex[MarkerR][iVertex]->GetNode();
2012  node[iPoint]->SetSensor(Buffer_Receive_Lambda[iVertex]);
2013 
2014  }
2015 
2016  /*--- Deallocate receive buffer ---*/
2017  delete [] Buffer_Receive_Lambda;
2018 
2019  }
2020 
2021  }
2022 }
2023 
2025  unsigned short iVar, iDim, iMarker, iPeriodic_Index, MarkerS, MarkerR;
2026  unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
2027  su2double rotMatrix[3][3], *angles, theta, cosTheta, sinTheta, phi, cosPhi, sinPhi, psi, cosPsi, sinPsi,
2028  *Buffer_Receive_Gradient = NULL, *Buffer_Send_Gradient = NULL;
2029 
2030  su2double **Gradient = new su2double* [nVar];
2031  for (iVar = 0; iVar < nVar; iVar++)
2032  Gradient[iVar] = new su2double[nDim];
2033 
2034 #ifdef HAVE_MPI
2035  int send_to, receive_from;
2036  SU2_MPI::Status status;
2037 #endif
2038 
2039  for (iMarker = 0; iMarker < nMarker; iMarker++) {
2040 
2041  if ((config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) &&
2042  (config->GetMarker_All_SendRecv(iMarker) > 0)) {
2043 
2044  MarkerS = iMarker; MarkerR = iMarker+1;
2045 
2046 #ifdef HAVE_MPI
2047  send_to = config->GetMarker_All_SendRecv(MarkerS)-1;
2048  receive_from = abs(config->GetMarker_All_SendRecv(MarkerR))-1;
2049 #endif
2050 
2051  nVertexS = geometry->nVertex[MarkerS]; nVertexR = geometry->nVertex[MarkerR];
2052  nBufferS_Vector = nVertexS*nVar*nDim; nBufferR_Vector = nVertexR*nVar*nDim;
2053 
2054  /*--- Allocate Receive and send buffers ---*/
2055  Buffer_Receive_Gradient = new su2double [nBufferR_Vector];
2056  Buffer_Send_Gradient = new su2double[nBufferS_Vector];
2057 
2058  /*--- Copy the solution old that should be sended ---*/
2059  for (iVertex = 0; iVertex < nVertexS; iVertex++) {
2060  iPoint = geometry->vertex[MarkerS][iVertex]->GetNode();
2061  for (iVar = 0; iVar < nVar; iVar++)
2062  for (iDim = 0; iDim < nDim; iDim++)
2063  Buffer_Send_Gradient[iDim*nVar*nVertexS+iVar*nVertexS+iVertex] = node[iPoint]->GetGradient(iVar, iDim);
2064  }
2065 
2066 #ifdef HAVE_MPI
2067 
2068  /*--- Send/Receive information using Sendrecv ---*/
2069  SU2_MPI::Sendrecv(Buffer_Send_Gradient, nBufferS_Vector, MPI_DOUBLE, send_to, 0,
2070  Buffer_Receive_Gradient, nBufferR_Vector, MPI_DOUBLE, receive_from, 0, MPI_COMM_WORLD, &status);
2071 
2072 #else
2073 
2074  /*--- Receive information without MPI ---*/
2075  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
2076  for (iVar = 0; iVar < nVar; iVar++)
2077  for (iDim = 0; iDim < nDim; iDim++)
2078  Buffer_Receive_Gradient[iDim*nVar*nVertexR+iVar*nVertexR+iVertex] = Buffer_Send_Gradient[iDim*nVar*nVertexR+iVar*nVertexR+iVertex];
2079  }
2080 
2081 #endif
2082 
2083  /*--- Deallocate send buffer ---*/
2084  delete [] Buffer_Send_Gradient;
2085 
2086  /*--- Do the coordinate transformation ---*/
2087  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
2088 
2089  /*--- Find point and its type of transformation ---*/
2090  iPoint = geometry->vertex[MarkerR][iVertex]->GetNode();
2091  iPeriodic_Index = geometry->vertex[MarkerR][iVertex]->GetRotation_Type();
2092 
2093  /*--- Retrieve the supplied periodic information. ---*/
2094  angles = config->GetPeriodicRotation(iPeriodic_Index);
2095 
2096  /*--- Store angles separately for clarity. ---*/
2097  theta = angles[0]; phi = angles[1]; psi = angles[2];
2098  cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
2099  sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
2100 
2101  /*--- Compute the rotation matrix. Note that the implicit
2102  ordering is rotation about the x-axis, y-axis,
2103  then z-axis. Note that this is the transpose of the matrix
2104  used during the preprocessing stage. ---*/
2105  rotMatrix[0][0] = cosPhi*cosPsi; rotMatrix[1][0] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi; rotMatrix[2][0] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
2106  rotMatrix[0][1] = cosPhi*sinPsi; rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi; rotMatrix[2][1] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
2107  rotMatrix[0][2] = -sinPhi; rotMatrix[1][2] = sinTheta*cosPhi; rotMatrix[2][2] = cosTheta*cosPhi;
2108 
2109  /*--- Copy conserved variables before performing transformation. ---*/
2110  for (iVar = 0; iVar < nVar; iVar++)
2111  for (iDim = 0; iDim < nDim; iDim++)
2112  Gradient[iVar][iDim] = Buffer_Receive_Gradient[iDim*nVar*nVertexR+iVar*nVertexR+iVertex];
2113 
2114  /*--- Need to rotate the gradients for all conserved variables. ---*/
2115  for (iVar = 0; iVar < nVar; iVar++) {
2116  if (nDim == 2) {
2117  Gradient[iVar][0] = rotMatrix[0][0]*Buffer_Receive_Gradient[0*nVar*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[0][1]*Buffer_Receive_Gradient[1*nVar*nVertexR+iVar*nVertexR+iVertex];
2118  Gradient[iVar][1] = rotMatrix[1][0]*Buffer_Receive_Gradient[0*nVar*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[1][1]*Buffer_Receive_Gradient[1*nVar*nVertexR+iVar*nVertexR+iVertex];
2119  }
2120  else {
2121  Gradient[iVar][0] = rotMatrix[0][0]*Buffer_Receive_Gradient[0*nVar*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[0][1]*Buffer_Receive_Gradient[1*nVar*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[0][2]*Buffer_Receive_Gradient[2*nVar*nVertexR+iVar*nVertexR+iVertex];
2122  Gradient[iVar][1] = rotMatrix[1][0]*Buffer_Receive_Gradient[0*nVar*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[1][1]*Buffer_Receive_Gradient[1*nVar*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[1][2]*Buffer_Receive_Gradient[2*nVar*nVertexR+iVar*nVertexR+iVertex];
2123  Gradient[iVar][2] = rotMatrix[2][0]*Buffer_Receive_Gradient[0*nVar*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[2][1]*Buffer_Receive_Gradient[1*nVar*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[2][2]*Buffer_Receive_Gradient[2*nVar*nVertexR+iVar*nVertexR+iVertex];
2124  }
2125  }
2126 
2127  /*--- Store the received information ---*/
2128  for (iVar = 0; iVar < nVar; iVar++)
2129  for (iDim = 0; iDim < nDim; iDim++)
2130  node[iPoint]->SetGradient(iVar, iDim, Gradient[iVar][iDim]);
2131 
2132  }
2133 
2134  /*--- Deallocate receive buffer ---*/
2135  delete [] Buffer_Receive_Gradient;
2136 
2137  }
2138 
2139  }
2140 
2141  for (iVar = 0; iVar < nVar; iVar++)
2142  delete [] Gradient[iVar];
2143  delete [] Gradient;
2144 
2145 }
2146 
2148  unsigned short iVar, iMarker, iPeriodic_Index, MarkerS, MarkerR;
2149  unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
2150  su2double rotMatrix[3][3], *angles, theta, cosTheta, sinTheta, phi, cosPhi, sinPhi, psi, cosPsi, sinPsi,
2151  *Buffer_Receive_Limit = NULL, *Buffer_Send_Limit = NULL;
2152 
2153  su2double *Limiter = new su2double [nVar];
2154 
2155 #ifdef HAVE_MPI
2156  int send_to, receive_from;
2157  SU2_MPI::Status status;
2158 #endif
2159 
2160  for (iMarker = 0; iMarker < nMarker; iMarker++) {
2161 
2162  if ((config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) &&
2163  (config->GetMarker_All_SendRecv(iMarker) > 0)) {
2164 
2165  MarkerS = iMarker; MarkerR = iMarker+1;
2166 
2167 #ifdef HAVE_MPI
2168  send_to = config->GetMarker_All_SendRecv(MarkerS)-1;
2169  receive_from = abs(config->GetMarker_All_SendRecv(MarkerR))-1;
2170 #endif
2171 
2172  nVertexS = geometry->nVertex[MarkerS]; nVertexR = geometry->nVertex[MarkerR];
2173  nBufferS_Vector = nVertexS*nVar; nBufferR_Vector = nVertexR*nVar;
2174 
2175  /*--- Allocate Receive and send buffers ---*/
2176  Buffer_Receive_Limit = new su2double [nBufferR_Vector];
2177  Buffer_Send_Limit = new su2double[nBufferS_Vector];
2178 
2179  /*--- Copy the solution old that should be sended ---*/
2180  for (iVertex = 0; iVertex < nVertexS; iVertex++) {
2181  iPoint = geometry->vertex[MarkerS][iVertex]->GetNode();
2182  for (iVar = 0; iVar < nVar; iVar++)
2183  Buffer_Send_Limit[iVar*nVertexS+iVertex] = node[iPoint]->GetLimiter(iVar);
2184  }
2185 
2186 #ifdef HAVE_MPI
2187 
2188  /*--- Send/Receive information using Sendrecv ---*/
2189  SU2_MPI::Sendrecv(Buffer_Send_Limit, nBufferS_Vector, MPI_DOUBLE, send_to, 0,
2190  Buffer_Receive_Limit, nBufferR_Vector, MPI_DOUBLE, receive_from, 0, MPI_COMM_WORLD, &status);
2191 
2192 #else
2193 
2194  /*--- Receive information without MPI ---*/
2195  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
2196  for (iVar = 0; iVar < nVar; iVar++)
2197  Buffer_Receive_Limit[iVar*nVertexR+iVertex] = Buffer_Send_Limit[iVar*nVertexR+iVertex];
2198  }
2199 
2200 #endif
2201 
2202  /*--- Deallocate send buffer ---*/
2203  delete [] Buffer_Send_Limit;
2204 
2205  /*--- Do the coordinate transformation ---*/
2206  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
2207 
2208  /*--- Find point and its type of transformation ---*/
2209  iPoint = geometry->vertex[MarkerR][iVertex]->GetNode();
2210  iPeriodic_Index = geometry->vertex[MarkerR][iVertex]->GetRotation_Type();
2211 
2212  /*--- Retrieve the supplied periodic information. ---*/
2213  angles = config->GetPeriodicRotation(iPeriodic_Index);
2214 
2215  /*--- Store angles separately for clarity. ---*/
2216  theta = angles[0]; phi = angles[1]; psi = angles[2];
2217  cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
2218  sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
2219 
2220  /*--- Compute the rotation matrix. Note that the implicit
2221  ordering is rotation about the x-axis, y-axis,
2222  then z-axis. Note that this is the transpose of the matrix
2223  used during the preprocessing stage. ---*/
2224  rotMatrix[0][0] = cosPhi*cosPsi; rotMatrix[1][0] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi; rotMatrix[2][0] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
2225  rotMatrix[0][1] = cosPhi*sinPsi; rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi; rotMatrix[2][1] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
2226  rotMatrix[0][2] = -sinPhi; rotMatrix[1][2] = sinTheta*cosPhi; rotMatrix[2][2] = cosTheta*cosPhi;
2227 
2228  /*--- Copy conserved variables before performing transformation. ---*/
2229  for (iVar = 0; iVar < nVar; iVar++)
2230  Limiter[iVar] = Buffer_Receive_Limit[iVar*nVertexR+iVertex];
2231 
2232  /*--- Rotate the momentum components. ---*/
2233  if (nDim == 2) {
2234  Limiter[1] = rotMatrix[0][0]*Buffer_Receive_Limit[1*nVertexR+iVertex] +
2235  rotMatrix[0][1]*Buffer_Receive_Limit[2*nVertexR+iVertex];
2236  Limiter[2] = rotMatrix[1][0]*Buffer_Receive_Limit[1*nVertexR+iVertex] +
2237  rotMatrix[1][1]*Buffer_Receive_Limit[2*nVertexR+iVertex];
2238  }
2239  else {
2240  Limiter[1] = rotMatrix[0][0]*Buffer_Receive_Limit[1*nVertexR+iVertex] +
2241  rotMatrix[0][1]*Buffer_Receive_Limit[2*nVertexR+iVertex] +
2242  rotMatrix[0][2]*Buffer_Receive_Limit[3*nVertexR+iVertex];
2243  Limiter[2] = rotMatrix[1][0]*Buffer_Receive_Limit[1*nVertexR+iVertex] +
2244  rotMatrix[1][1]*Buffer_Receive_Limit[2*nVertexR+iVertex] +
2245  rotMatrix[1][2]*Buffer_Receive_Limit[3*nVertexR+iVertex];
2246  Limiter[3] = rotMatrix[2][0]*Buffer_Receive_Limit[1*nVertexR+iVertex] +
2247  rotMatrix[2][1]*Buffer_Receive_Limit[2*nVertexR+iVertex] +
2248  rotMatrix[2][2]*Buffer_Receive_Limit[3*nVertexR+iVertex];
2249  }
2250 
2251  /*--- Copy transformed conserved variables back into buffer. ---*/
2252  for (iVar = 0; iVar < nVar; iVar++)
2253  node[iPoint]->SetLimiter(iVar, Limiter[iVar]);
2254 
2255  }
2256 
2257  /*--- Deallocate receive buffer ---*/
2258  delete [] Buffer_Receive_Limit;
2259 
2260  }
2261 
2262  }
2263 
2264  delete [] Limiter;
2265 
2266 }
2267 
2269  unsigned short iVar, iDim, iMarker, iPeriodic_Index, MarkerS, MarkerR;
2270  unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
2271  su2double rotMatrix[3][3], *angles, theta, cosTheta, sinTheta, phi, cosPhi, sinPhi, psi, cosPsi, sinPsi,
2272  *Buffer_Receive_Gradient = NULL, *Buffer_Send_Gradient = NULL;
2273 
2274  su2double **Gradient = new su2double* [nPrimVarGrad];
2275  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
2276  Gradient[iVar] = new su2double[nDim];
2277 
2278 #ifdef HAVE_MPI
2279  int send_to, receive_from;
2280  SU2_MPI::Status status;
2281 #endif
2282 
2283  for (iMarker = 0; iMarker < nMarker; iMarker++) {
2284 
2285  if ((config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) &&
2286  (config->GetMarker_All_SendRecv(iMarker) > 0)) {
2287 
2288  MarkerS = iMarker; MarkerR = iMarker+1;
2289 
2290 #ifdef HAVE_MPI
2291  send_to = config->GetMarker_All_SendRecv(MarkerS)-1;
2292  receive_from = abs(config->GetMarker_All_SendRecv(MarkerR))-1;
2293 #endif
2294 
2295  nVertexS = geometry->nVertex[MarkerS]; nVertexR = geometry->nVertex[MarkerR];
2296  nBufferS_Vector = nVertexS*nPrimVarGrad*nDim; nBufferR_Vector = nVertexR*nPrimVarGrad*nDim;
2297 
2298  /*--- Allocate Receive and send buffers ---*/
2299  Buffer_Receive_Gradient = new su2double [nBufferR_Vector];
2300  Buffer_Send_Gradient = new su2double[nBufferS_Vector];
2301 
2302  /*--- Copy the solution old that should be sended ---*/
2303  for (iVertex = 0; iVertex < nVertexS; iVertex++) {
2304  iPoint = geometry->vertex[MarkerS][iVertex]->GetNode();
2305  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
2306  for (iDim = 0; iDim < nDim; iDim++)
2307  Buffer_Send_Gradient[iDim*nPrimVarGrad*nVertexS+iVar*nVertexS+iVertex] = node[iPoint]->GetGradient_Primitive(iVar, iDim);
2308  }
2309 
2310 #ifdef HAVE_MPI
2311 
2312  /*--- Send/Receive information using Sendrecv ---*/
2313  SU2_MPI::Sendrecv(Buffer_Send_Gradient, nBufferS_Vector, MPI_DOUBLE, send_to, 0,
2314  Buffer_Receive_Gradient, nBufferR_Vector, MPI_DOUBLE, receive_from, 0, MPI_COMM_WORLD, &status);
2315 
2316 #else
2317 
2318  /*--- Receive information without MPI ---*/
2319  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
2320  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
2321  for (iDim = 0; iDim < nDim; iDim++)
2322  Buffer_Receive_Gradient[iDim*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex] = Buffer_Send_Gradient[iDim*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex];
2323  }
2324 
2325 #endif
2326 
2327  /*--- Deallocate send buffer ---*/
2328  delete [] Buffer_Send_Gradient;
2329 
2330  /*--- Do the coordinate transformation ---*/
2331  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
2332 
2333  /*--- Find point and its type of transformation ---*/
2334  iPoint = geometry->vertex[MarkerR][iVertex]->GetNode();
2335  iPeriodic_Index = geometry->vertex[MarkerR][iVertex]->GetRotation_Type();
2336 
2337  /*--- Retrieve the supplied periodic information. ---*/
2338  angles = config->GetPeriodicRotation(iPeriodic_Index);
2339 
2340  /*--- Store angles separately for clarity. ---*/
2341  theta = angles[0]; phi = angles[1]; psi = angles[2];
2342  cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
2343  sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
2344 
2345  /*--- Compute the rotation matrix. Note that the implicit
2346  ordering is rotation about the x-axis, y-axis,
2347  then z-axis. Note that this is the transpose of the matrix
2348  used during the preprocessing stage. ---*/
2349  rotMatrix[0][0] = cosPhi*cosPsi; rotMatrix[1][0] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi; rotMatrix[2][0] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
2350  rotMatrix[0][1] = cosPhi*sinPsi; rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi; rotMatrix[2][1] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
2351  rotMatrix[0][2] = -sinPhi; rotMatrix[1][2] = sinTheta*cosPhi; rotMatrix[2][2] = cosTheta*cosPhi;
2352 
2353  /*--- Copy conserved variables before performing transformation. ---*/
2354  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
2355  for (iDim = 0; iDim < nDim; iDim++)
2356  Gradient[iVar][iDim] = Buffer_Receive_Gradient[iDim*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex];
2357 
2358  /*--- Need to rotate the gradients for all conserved variables. ---*/
2359  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
2360  if (nDim == 2) {
2361  Gradient[iVar][0] = rotMatrix[0][0]*Buffer_Receive_Gradient[0*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[0][1]*Buffer_Receive_Gradient[1*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex];
2362  Gradient[iVar][1] = rotMatrix[1][0]*Buffer_Receive_Gradient[0*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[1][1]*Buffer_Receive_Gradient[1*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex];
2363  }
2364  else {
2365  Gradient[iVar][0] = rotMatrix[0][0]*Buffer_Receive_Gradient[0*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[0][1]*Buffer_Receive_Gradient[1*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[0][2]*Buffer_Receive_Gradient[2*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex];
2366  Gradient[iVar][1] = rotMatrix[1][0]*Buffer_Receive_Gradient[0*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[1][1]*Buffer_Receive_Gradient[1*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[1][2]*Buffer_Receive_Gradient[2*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex];
2367  Gradient[iVar][2] = rotMatrix[2][0]*Buffer_Receive_Gradient[0*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[2][1]*Buffer_Receive_Gradient[1*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex] + rotMatrix[2][2]*Buffer_Receive_Gradient[2*nPrimVarGrad*nVertexR+iVar*nVertexR+iVertex];
2368  }
2369  }
2370 
2371  /*--- Store the received information ---*/
2372  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
2373  for (iDim = 0; iDim < nDim; iDim++)
2374  node[iPoint]->SetGradient_Primitive(iVar, iDim, Gradient[iVar][iDim]);
2375 
2376  }
2377 
2378  /*--- Deallocate receive buffer ---*/
2379  delete [] Buffer_Receive_Gradient;
2380 
2381  }
2382 
2383  }
2384 
2385  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
2386  delete [] Gradient[iVar];
2387  delete [] Gradient;
2388 
2389 }
2390 
2392  unsigned short iVar, iMarker, iPeriodic_Index, MarkerS, MarkerR;
2393  unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
2394  su2double rotMatrix[3][3], *angles, theta, cosTheta, sinTheta, phi, cosPhi, sinPhi, psi, cosPsi, sinPsi,
2395  *Buffer_Receive_Limit = NULL, *Buffer_Send_Limit = NULL;
2396 
2397  su2double *Limiter = new su2double [nPrimVarGrad];
2398 
2399 #ifdef HAVE_MPI
2400  int send_to, receive_from;
2401  SU2_MPI::Status status;
2402 #endif
2403 
2404  for (iMarker = 0; iMarker < nMarker; iMarker++) {
2405 
2406  if ((config->GetMarker_All_KindBC(iMarker) == SEND_RECEIVE) &&
2407  (config->GetMarker_All_SendRecv(iMarker) > 0)) {
2408 
2409  MarkerS = iMarker; MarkerR = iMarker+1;
2410 
2411 #ifdef HAVE_MPI
2412  send_to = config->GetMarker_All_SendRecv(MarkerS)-1;
2413  receive_from = abs(config->GetMarker_All_SendRecv(MarkerR))-1;
2414 #endif
2415 
2416  nVertexS = geometry->nVertex[MarkerS]; nVertexR = geometry->nVertex[MarkerR];
2417  nBufferS_Vector = nVertexS*nPrimVarGrad; nBufferR_Vector = nVertexR*nPrimVarGrad;
2418 
2419  /*--- Allocate Receive and send buffers ---*/
2420  Buffer_Receive_Limit = new su2double [nBufferR_Vector];
2421  Buffer_Send_Limit = new su2double[nBufferS_Vector];
2422 
2423  /*--- Copy the solution old that should be sended ---*/
2424  for (iVertex = 0; iVertex < nVertexS; iVertex++) {
2425  iPoint = geometry->vertex[MarkerS][iVertex]->GetNode();
2426  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
2427  Buffer_Send_Limit[iVar*nVertexS+iVertex] = node[iPoint]->GetLimiter_Primitive(iVar);
2428  }
2429 
2430 #ifdef HAVE_MPI
2431 
2432  /*--- Send/Receive information using Sendrecv ---*/
2433  SU2_MPI::Sendrecv(Buffer_Send_Limit, nBufferS_Vector, MPI_DOUBLE, send_to, 0,
2434  Buffer_Receive_Limit, nBufferR_Vector, MPI_DOUBLE, receive_from, 0, MPI_COMM_WORLD, &status);
2435 
2436 #else
2437 
2438  /*--- Receive information without MPI ---*/
2439  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
2440  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
2441  Buffer_Receive_Limit[iVar*nVertexR+iVertex] = Buffer_Send_Limit[iVar*nVertexR+iVertex];
2442  }
2443 
2444 #endif
2445 
2446  /*--- Deallocate send buffer ---*/
2447  delete [] Buffer_Send_Limit;
2448 
2449  /*--- Do the coordinate transformation ---*/
2450  for (iVertex = 0; iVertex < nVertexR; iVertex++) {
2451 
2452  /*--- Find point and its type of transformation ---*/
2453  iPoint = geometry->vertex[MarkerR][iVertex]->GetNode();
2454  iPeriodic_Index = geometry->vertex[MarkerR][iVertex]->GetRotation_Type();
2455 
2456  /*--- Retrieve the supplied periodic information. ---*/
2457  angles = config->GetPeriodicRotation(iPeriodic_Index);
2458 
2459  /*--- Store angles separately for clarity. ---*/
2460  theta = angles[0]; phi = angles[1]; psi = angles[2];
2461  cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
2462  sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
2463 
2464  /*--- Compute the rotation matrix. Note that the implicit
2465  ordering is rotation about the x-axis, y-axis,
2466  then z-axis. Note that this is the transpose of the matrix
2467  used during the preprocessing stage. ---*/
2468  rotMatrix[0][0] = cosPhi*cosPsi; rotMatrix[1][0] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi; rotMatrix[2][0] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
2469  rotMatrix[0][1] = cosPhi*sinPsi; rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi; rotMatrix[2][1] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
2470  rotMatrix[0][2] = -sinPhi; rotMatrix[1][2] = sinTheta*cosPhi; rotMatrix[2][2] = cosTheta*cosPhi;
2471 
2472  /*--- Copy conserved variables before performing transformation. ---*/
2473  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
2474  Limiter[iVar] = Buffer_Receive_Limit[iVar*nVertexR+iVertex];
2475 
2476  /*--- Rotate the momentum components. ---*/
2477  if (nDim == 2) {
2478  Limiter[1] = rotMatrix[0][0]*Buffer_Receive_Limit[1*nVertexR+iVertex] +
2479  rotMatrix[0][1]*Buffer_Receive_Limit[2*nVertexR+iVertex];
2480  Limiter[2] = rotMatrix[1][0]*Buffer_Receive_Limit[1*nVertexR+iVertex] +
2481  rotMatrix[1][1]*Buffer_Receive_Limit[2*nVertexR+iVertex];
2482  }
2483  else {
2484  Limiter[1] = rotMatrix[0][0]*Buffer_Receive_Limit[1*nVertexR+iVertex] +
2485  rotMatrix[0][1]*Buffer_Receive_Limit[2*nVertexR+iVertex] +
2486  rotMatrix[0][2]*Buffer_Receive_Limit[3*nVertexR+iVertex];
2487  Limiter[2] = rotMatrix[1][0]*Buffer_Receive_Limit[1*nVertexR+iVertex] +
2488  rotMatrix[1][1]*Buffer_Receive_Limit[2*nVertexR+iVertex] +
2489  rotMatrix[1][2]*Buffer_Receive_Limit[3*nVertexR+iVertex];
2490  Limiter[3] = rotMatrix[2][0]*Buffer_Receive_Limit[1*nVertexR+iVertex] +
2491  rotMatrix[2][1]*Buffer_Receive_Limit[2*nVertexR+iVertex] +
2492  rotMatrix[2][2]*Buffer_Receive_Limit[3*nVertexR+iVertex];
2493  }
2494 
2495  /*--- Copy transformed conserved variables back into buffer. ---*/
2496  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
2497  node[iPoint]->SetLimiter_Primitive(iVar, Limiter[iVar]);
2498 
2499  }
2500 
2501  /*--- Deallocate receive buffer ---*/
2502  delete [] Buffer_Receive_Limit;
2503 
2504  }
2505 
2506  }
2507 
2508  delete [] Limiter;
2509 
2510 }
2511 
2512 void CEulerSolver::Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geometry, CConfig *config) {
2513 
2514  unsigned long iter, iPoint, iVertex, jVertex, iPointTotal,
2515  Buffer_Send_nPointTotal = 0;
2516  long iGlobalIndex, iGlobal;
2517  unsigned short iVar, iMarker, jMarker;
2518  long nDomain = 0, iDomain, jDomain;
2519  //bool ActDisk_Perimeter;
2520  bool rans = ((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS));
2521 
2522  unsigned short nPrimVar_ = nPrimVar;
2523  if (rans) nPrimVar_ += 2; // Add two extra variables for the turbulence.
2524 
2525 #ifdef HAVE_MPI
2526 
2527  /*--- MPI status and request arrays for non-blocking communications ---*/
2528 
2529  SU2_MPI::Status status;
2530 
2531 #endif
2532 
2533  /*--- Define buffer vector interior domain ---*/
2534 
2535  su2double *Buffer_Send_PrimVar = NULL;
2536  long *Buffer_Send_Data = NULL;
2537 
2538  unsigned long *nPointTotal_s = new unsigned long[size];
2539  unsigned long *nPointTotal_r = new unsigned long[size];
2540  su2double *iPrimVar = new su2double [nPrimVar_];
2541 
2542  unsigned long Buffer_Size_PrimVar = 0;
2543  unsigned long Buffer_Size_Data = 0;
2544 
2545  unsigned long PointTotal_Counter = 0;
2546 
2547  /*--- Allocate the memory that we only need if we have MPI support ---*/
2548 
2549  su2double *Buffer_Receive_PrimVar = NULL;
2550  long *Buffer_Receive_Data = NULL;
2551 
2552  /*--- Basic dimensionalization ---*/
2553 
2554  nDomain = size;
2555 
2556  /*--- This loop gets the array sizes of points for each
2557  rank to send to each other rank. ---*/
2558 
2559  for (iDomain = 0; iDomain < nDomain; iDomain++) {
2560 
2561  /*--- Loop over the markers to perform the dimensionalizaton
2562  of the domain variables ---*/
2563 
2564  Buffer_Send_nPointTotal = 0;
2565 
2566  /*--- Loop over all of the markers and count the number of each
2567  type of point and element that needs to be sent. ---*/
2568 
2569  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
2570  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) ||
2571  (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) {
2572  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
2573  //ActDisk_Perimeter = geometry->vertex[iMarker][iVertex]->GetActDisk_Perimeter();
2574  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
2575  jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
2576 // if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain()) && (!ActDisk_Perimeter)) {
2577  if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
2578  Buffer_Send_nPointTotal++;
2579  }
2580  }
2581  }
2582  }
2583 
2584  /*--- Store the counts on a partition by partition basis. ---*/
2585 
2586  nPointTotal_s[iDomain] = Buffer_Send_nPointTotal;
2587 
2588  /*--- Total counts for allocating send buffers below ---*/
2589 
2590  Buffer_Size_PrimVar += nPointTotal_s[iDomain]*(nPrimVar_);
2591  Buffer_Size_Data += nPointTotal_s[iDomain]*(3);
2592 
2593  }
2594 
2595  /*--- Allocate the buffer vectors in the appropiate domain (master, iDomain) ---*/
2596 
2597  Buffer_Send_PrimVar = new su2double[Buffer_Size_PrimVar];
2598  Buffer_Send_Data = new long[Buffer_Size_Data];
2599 
2600  /*--- Now that we know the sizes of the point, we can
2601  allocate and send the information in large chunks to all processors. ---*/
2602 
2603  for (iDomain = 0; iDomain < nDomain; iDomain++) {
2604 
2605  /*--- A rank does not communicate with itself through MPI ---*/
2606 
2607  if (rank != iDomain) {
2608 
2609 #ifdef HAVE_MPI
2610 
2611  /*--- Communicate the counts to iDomain with non-blocking sends ---*/
2612 
2613  SU2_MPI::Bsend(&nPointTotal_s[iDomain], 1, MPI_UNSIGNED_LONG, iDomain, iDomain, MPI_COMM_WORLD);
2614 
2615 #endif
2616 
2617  } else {
2618 
2619  /*--- If iDomain = rank, we simply copy values into place in memory ---*/
2620 
2621  nPointTotal_r[iDomain] = nPointTotal_s[iDomain];
2622 
2623  }
2624 
2625  /*--- Receive the counts. All processors are sending their counters to
2626  iDomain up above, so only iDomain needs to perform the recv here from
2627  all other ranks. ---*/
2628 
2629  if (rank == iDomain) {
2630 
2631  for (jDomain = 0; jDomain < size; jDomain++) {
2632 
2633  /*--- A rank does not communicate with itself through MPI ---*/
2634 
2635  if (rank != jDomain) {
2636 
2637 #ifdef HAVE_MPI
2638 
2639  /*--- Recv the data by probing for the current sender, jDomain,
2640  first and then receiving the values from it. ---*/
2641 
2642  SU2_MPI::Recv(&nPointTotal_r[jDomain], 1, MPI_UNSIGNED_LONG, jDomain, rank, MPI_COMM_WORLD, &status);
2643 
2644 #endif
2645 
2646  }
2647  }
2648 
2649  }
2650  }
2651 
2652  /*--- Wait for the non-blocking sends to complete. ---*/
2653 
2654 #ifdef HAVE_MPI
2655 
2657 
2658 #endif
2659 
2660  /*--- Initialize the counters for the larger send buffers (by domain) ---*/
2661 
2662  PointTotal_Counter = 0;
2663 
2664  for (iDomain = 0; iDomain < nDomain; iDomain++) {
2665 
2666  /*--- Set the value of the interior geometry. Initialize counters. ---*/
2667 
2668  iPointTotal = 0;
2669 
2670  /*--- Load up the actual values into the buffers for sending. ---*/
2671 
2672  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
2673 
2674  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) ||
2675  (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) {
2676  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
2677  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
2678 
2679  jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
2680  //ActDisk_Perimeter = geometry->vertex[iMarker][iVertex]->GetActDisk_Perimeter();
2681 
2682 // if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain()) && (!ActDisk_Perimeter)) {
2683  if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
2684 
2685  for (iVar = 0; iVar < nPrimVar; iVar++) {
2686  Buffer_Send_PrimVar[(nPrimVar_)*(PointTotal_Counter+iPointTotal)+iVar] = node[iPoint]->GetPrimitive(iVar);
2687  }
2688  if (rans) {
2689  Buffer_Send_PrimVar[(nPrimVar_)*(PointTotal_Counter+iPointTotal)+nPrimVar] = solver_container[TURB_SOL]->node[iPoint]->GetSolution(0);
2690  Buffer_Send_PrimVar[(nPrimVar_)*(PointTotal_Counter+iPointTotal)+(nPrimVar+1)] = 0.0;
2691  }
2692 
2693  iGlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
2694  jVertex = geometry->vertex[iMarker][iVertex]->GetDonorVertex();
2695  jMarker = geometry->vertex[iMarker][iVertex]->GetDonorMarker();
2696 
2697  Buffer_Send_Data[(3)*(PointTotal_Counter+iPointTotal)+(0)] = iGlobalIndex;
2698  Buffer_Send_Data[(3)*(PointTotal_Counter+iPointTotal)+(1)] = jVertex;
2699  Buffer_Send_Data[(3)*(PointTotal_Counter+iPointTotal)+(2)] = jMarker;
2700 
2701  iPointTotal++;
2702 
2703  }
2704 
2705  }
2706 
2707  }
2708 
2709  }
2710 
2711  /*--- Send the buffers with the geometrical information ---*/
2712 
2713  if (iDomain != rank) {
2714 
2715 #ifdef HAVE_MPI
2716 
2717  /*--- Communicate the coordinates, global index, colors, and element
2718  date to iDomain with non-blocking sends. ---*/
2719 
2720  SU2_MPI::Bsend(&Buffer_Send_PrimVar[PointTotal_Counter*(nPrimVar_)],
2721  nPointTotal_s[iDomain]*(nPrimVar_), MPI_DOUBLE, iDomain,
2722  iDomain, MPI_COMM_WORLD);
2723 
2724  SU2_MPI::Bsend(&Buffer_Send_Data[PointTotal_Counter*(3)],
2725  nPointTotal_s[iDomain]*(3), MPI_LONG, iDomain,
2726  iDomain+nDomain, MPI_COMM_WORLD);
2727 
2728 #endif
2729 
2730  }
2731 
2732  else {
2733 
2734  /*--- Allocate local memory for the local recv of the elements ---*/
2735 
2736  Buffer_Receive_PrimVar = new su2double[nPointTotal_s[iDomain]*(nPrimVar_)];
2737  Buffer_Receive_Data = new long[nPointTotal_s[iDomain]*(3)];
2738 
2739  for (iter = 0; iter < nPointTotal_s[iDomain]*(nPrimVar_); iter++)
2740  Buffer_Receive_PrimVar[iter] = Buffer_Send_PrimVar[PointTotal_Counter*(nPrimVar_)+iter];
2741 
2742  for (iter = 0; iter < nPointTotal_s[iDomain]*(3); iter++)
2743  Buffer_Receive_Data[iter] = Buffer_Send_Data[PointTotal_Counter*(3)+iter];
2744 
2745 
2746  /*--- Recv the point data from ourselves (same procedure as above) ---*/
2747 
2748  for (iPoint = 0; iPoint < nPointTotal_r[iDomain]; iPoint++) {
2749 
2750  for (iVar = 0; iVar < nPrimVar_; iVar++)
2751  iPrimVar[iVar] = Buffer_Receive_PrimVar[iPoint*(nPrimVar_)+iVar];
2752 
2753  iGlobal = Buffer_Receive_Data[iPoint*(3)+(0)];
2754  iVertex = Buffer_Receive_Data[iPoint*(3)+(1)];
2755  iMarker = Buffer_Receive_Data[iPoint*(3)+(2)];
2756 
2757  for (iVar = 0; iVar < nPrimVar_; iVar++)
2758  SetDonorPrimVar(iMarker, iVertex, iVar, iPrimVar[iVar]);
2759 
2760  SetDonorGlobalIndex(iMarker, iVertex, iGlobal);
2761 
2762  }
2763 
2764  /*--- Delete memory for recv the point stuff ---*/
2765 
2766  delete [] Buffer_Receive_PrimVar;
2767  delete [] Buffer_Receive_Data;
2768 
2769  }
2770 
2771  /*--- Increment the counters for the send buffers (iDomain loop) ---*/
2772 
2773  PointTotal_Counter += iPointTotal;
2774 
2775  }
2776 
2777  /*--- Wait for the non-blocking sends to complete. ---*/
2778 
2779 #ifdef HAVE_MPI
2780 
2782 
2783 #endif
2784 
2785  /*--- The next section begins the recv of all data for the interior
2786  points/elements in the mesh. First, create the domain structures for
2787  the points on this rank. First, we recv all of the point data ---*/
2788 
2789  for (iDomain = 0; iDomain < size; iDomain++) {
2790 
2791  if (rank != iDomain) {
2792 
2793 #ifdef HAVE_MPI
2794 
2795  /*--- Allocate the receive buffer vector. Send the colors so that we
2796  know whether what we recv is an owned or halo node. ---*/
2797 
2798  Buffer_Receive_PrimVar = new su2double [nPointTotal_r[iDomain]*(nPrimVar_)];
2799  Buffer_Receive_Data = new long [nPointTotal_r[iDomain]*(3)];
2800 
2801  /*--- Receive the buffers with the coords, global index, and colors ---*/
2802 
2803  SU2_MPI::Recv(Buffer_Receive_PrimVar, nPointTotal_r[iDomain]*(nPrimVar_) , MPI_DOUBLE,
2804  iDomain, rank, MPI_COMM_WORLD, &status);
2805 
2806  SU2_MPI::Recv(Buffer_Receive_Data, nPointTotal_r[iDomain]*(3) , MPI_LONG,
2807  iDomain, rank+nDomain, MPI_COMM_WORLD, &status);
2808 
2809  /*--- Loop over all of the points that we have recv'd and store the
2810  coords, global index vertex and markers ---*/
2811 
2812  for (iPoint = 0; iPoint < nPointTotal_r[iDomain]; iPoint++) {
2813 
2814  iGlobal = Buffer_Receive_Data[iPoint*(3)+(0)];
2815  iVertex = Buffer_Receive_Data[iPoint*(3)+(1)];
2816  iMarker = Buffer_Receive_Data[iPoint*(3)+(2)];
2817 
2818  for (iVar = 0; iVar < nPrimVar_; iVar++)
2819  iPrimVar[iVar] = Buffer_Receive_PrimVar[iPoint*(nPrimVar_)+iVar];
2820 
2821  for (iVar = 0; iVar < nPrimVar_; iVar++) {
2822  SetDonorPrimVar(iMarker, iVertex, iVar, iPrimVar[iVar]);
2823  }
2824 
2825  SetDonorGlobalIndex(iMarker, iVertex, iGlobal);
2826 
2827  }
2828 
2829  /*--- Delete memory for recv the point stuff ---*/
2830 
2831  delete [] Buffer_Receive_PrimVar;
2832  delete [] Buffer_Receive_Data;
2833 
2834 #endif
2835 
2836  }
2837 
2838  }
2839 
2840  /*--- Wait for the non-blocking sends to complete. ---*/
2841 
2842 #ifdef HAVE_MPI
2843 
2845 
2846 #endif
2847 
2848  /*--- Free all of the memory used for communicating points and elements ---*/
2849 
2850  delete[] Buffer_Send_PrimVar;
2851  delete[] Buffer_Send_Data;
2852 
2853  /*--- Release all of the temporary memory ---*/
2854 
2855  delete [] nPointTotal_s;
2856  delete [] nPointTotal_r;
2857  delete [] iPrimVar;
2858 
2859 }
2860 
2862 
2863  unsigned long iter, iPoint, iVertex, jVertex, iPointTotal,
2864  Buffer_Send_nPointTotal = 0;
2865  long iGlobalIndex, iGlobal;
2866  unsigned short iVar, iMarker, jMarker;
2867  long nDomain = 0, iDomain, jDomain;
2868 
2869 #ifdef HAVE_MPI
2870 
2871  /*--- MPI status and request arrays for non-blocking communications ---*/
2872 
2873  SU2_MPI::Status status, status_;
2874 
2875 
2876 #endif
2877 
2878  /*--- Define buffer vector interior domain ---*/
2879 
2880  su2double *Buffer_Send_PrimVar = NULL;
2881 
2882  unsigned long *nPointTotal_s = new unsigned long[size];
2883  unsigned long *nPointTotal_r = new unsigned long[size];
2884  su2double *iPrimVar = new su2double [nPrimVar];
2885 
2886  unsigned long Buffer_Size_PrimVar = 0;
2887 
2888  unsigned long PointTotal_Counter = 0;
2889 
2890  /*--- Allocate the memory that we only need if we have MPI support ---*/
2891 
2892  su2double *Buffer_Receive_PrimVar = NULL;
2893 
2894  /*--- Basic dimensionalization ---*/
2895 
2896  nDomain = size;
2897 
2898  /*--- This loop gets the array sizes of points for each
2899  rank to send to each other rank. ---*/
2900 
2901  for (iDomain = 0; iDomain < nDomain; iDomain++) {
2902 
2903  /*--- Loop over the markers to perform the dimensionalizaton
2904  of the domain variables ---*/
2905 
2906  Buffer_Send_nPointTotal = 0;
2907 
2908  /*--- Loop over all of the markers and count the number of each
2909  type of point and element that needs to be sent. ---*/
2910 
2911  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
2912  if (config->GetMarker_All_KindBC(iMarker) == NEARFIELD_BOUNDARY) {
2913  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
2914  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
2915  jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
2916  if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
2917  Buffer_Send_nPointTotal++;
2918  }
2919  }
2920  }
2921  }
2922 
2923  /*--- Store the counts on a partition by partition basis. ---*/
2924 
2925  nPointTotal_s[iDomain] = Buffer_Send_nPointTotal;
2926 
2927  /*--- Total counts for allocating send buffers below ---*/
2928 
2929  Buffer_Size_PrimVar += nPointTotal_s[iDomain]*(nPrimVar+3);
2930 
2931  }
2932 
2933  /*--- Allocate the buffer vectors in the appropiate domain (master, iDomain) ---*/
2934 
2935  Buffer_Send_PrimVar = new su2double[Buffer_Size_PrimVar];
2936 
2937  /*--- Now that we know the sizes of the point, we can
2938  allocate and send the information in large chunks to all processors. ---*/
2939 
2940  for (iDomain = 0; iDomain < nDomain; iDomain++) {
2941 
2942  /*--- A rank does not communicate with itself through MPI ---*/
2943 
2944  if (rank != iDomain) {
2945 
2946 #ifdef HAVE_MPI
2947 
2948  /*--- Communicate the counts to iDomain with non-blocking sends ---*/
2949 
2950  SU2_MPI::Bsend(&nPointTotal_s[iDomain], 1, MPI_UNSIGNED_LONG, iDomain, iDomain, MPI_COMM_WORLD);
2951 
2952 #endif
2953 
2954  } else {
2955 
2956  /*--- If iDomain = rank, we simply copy values into place in memory ---*/
2957 
2958  nPointTotal_r[iDomain] = nPointTotal_s[iDomain];
2959 
2960  }
2961 
2962  /*--- Receive the counts. All processors are sending their counters to
2963  iDomain up above, so only iDomain needs to perform the recv here from
2964  all other ranks. ---*/
2965 
2966  if (rank == iDomain) {
2967 
2968  for (jDomain = 0; jDomain < size; jDomain++) {
2969 
2970  /*--- A rank does not communicate with itself through MPI ---*/
2971 
2972  if (rank != jDomain) {
2973 
2974 #ifdef HAVE_MPI
2975 
2976  /*--- Recv the data by probing for the current sender, jDomain,
2977  first and then receiving the values from it. ---*/
2978 
2979  SU2_MPI::Recv(&nPointTotal_r[jDomain], 1, MPI_UNSIGNED_LONG, jDomain, rank, MPI_COMM_WORLD, &status);
2980 
2981 #endif
2982 
2983  }
2984  }
2985 
2986  }
2987  }
2988 
2989  /*--- Wait for the non-blocking sends to complete. ---*/
2990 
2991 #ifdef HAVE_MPI
2992 
2994 
2995 #endif
2996 
2997  /*--- Initialize the counters for the larger send buffers (by domain) ---*/
2998 
2999  PointTotal_Counter = 0;
3000 
3001  for (iDomain = 0; iDomain < nDomain; iDomain++) {
3002 
3003  /*--- Set the value of the interior geometry. Initialize counters. ---*/
3004 
3005  iPointTotal = 0;
3006 
3007  /*--- Load up the actual values into the buffers for sending. ---*/
3008 
3009  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
3010 
3011  if (config->GetMarker_All_KindBC(iMarker) == NEARFIELD_BOUNDARY) {
3012 
3013  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
3014  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
3015  jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
3016  if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
3017  iGlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
3018  jVertex = geometry->vertex[iMarker][iVertex]->GetDonorVertex();
3019  jMarker = geometry->vertex[iMarker][iVertex]->GetDonorMarker();
3020  for (iVar = 0; iVar < nPrimVar; iVar++) {
3021  Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+iVar] = node[iPoint]->GetPrimitive(iVar);
3022  }
3023  Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+(nPrimVar+0)] = su2double(iGlobalIndex);
3024  Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+(nPrimVar+1)] = su2double(jVertex);
3025  Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+(nPrimVar+2)] = su2double(jMarker);
3026 
3027  iPointTotal++;
3028 
3029  }
3030 
3031  }
3032 
3033  }
3034 
3035  }
3036 
3037  /*--- Send the buffers with the geometrical information ---*/
3038 
3039  if (iDomain != rank) {
3040 
3041 #ifdef HAVE_MPI
3042 
3043  /*--- Communicate the coordinates, global index, colors, and element
3044  date to iDomain with non-blocking sends. ---*/
3045 
3046  SU2_MPI::Bsend(&Buffer_Send_PrimVar[PointTotal_Counter*(nPrimVar+3)],
3047  nPointTotal_s[iDomain]*(nPrimVar+3), MPI_DOUBLE, iDomain,
3048  iDomain, MPI_COMM_WORLD);
3049 
3050 #endif
3051 
3052  }
3053 
3054  else {
3055 
3056  /*--- Allocate local memory for the local recv of the elements ---*/
3057 
3058  Buffer_Receive_PrimVar = new su2double[nPointTotal_s[iDomain]*(nPrimVar+3)];
3059 
3060  for (iter = 0; iter < nPointTotal_s[iDomain]*(nPrimVar+3); iter++)
3061  Buffer_Receive_PrimVar[iter] = Buffer_Send_PrimVar[PointTotal_Counter*(nPrimVar+3)+iter];
3062 
3063  /*--- Recv the point data from ourselves (same procedure as above) ---*/
3064 
3065  for (iPoint = 0; iPoint < nPointTotal_r[iDomain]; iPoint++) {
3066 
3067  iGlobal = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+0)]);
3068  iVertex = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+1)]);
3069  iMarker = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+2)]);
3070  for (iVar = 0; iVar < nPrimVar; iVar++)
3071  iPrimVar[iVar] = Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+iVar];
3072 
3073  if (iVertex < 0.0) cout <<" Negative iVertex (receive)" << endl;
3074  if (iMarker < 0.0) cout <<" Negative iMarker (receive)" << endl;
3075 
3076  if (iMarker > nMarker) cout << "ERROR" << endl;
3077  if (iVertex > geometry->nVertex[iMarker]) cout << "ERROR" << endl;
3078 
3079  for (iVar = 0; iVar < nPrimVar; iVar++)
3080  SetDonorPrimVar(iMarker, iVertex, iVar, iPrimVar[iVar]);
3081 
3082  SetDonorGlobalIndex(iMarker, iVertex, iGlobal);
3083 
3084  }
3085 
3086  /*--- Delete memory for recv the point stuff ---*/
3087 
3088  delete [] Buffer_Receive_PrimVar;
3089 
3090  }
3091 
3092  /*--- Increment the counters for the send buffers (iDomain loop) ---*/
3093 
3094  PointTotal_Counter += iPointTotal;
3095 
3096  }
3097 
3098  /*--- Wait for the non-blocking sends to complete. ---*/
3099 
3100 #ifdef HAVE_MPI
3101 
3103 
3104 #endif
3105 
3106  /*--- The next section begins the recv of all data for the interior
3107  points/elements in the mesh. First, create the domain structures for
3108  the points on this rank. First, we recv all of the point data ---*/
3109 
3110  for (iDomain = 0; iDomain < size; iDomain++) {
3111 
3112  if (rank != iDomain) {
3113 
3114 #ifdef HAVE_MPI
3115 
3116  /*--- Allocate the receive buffer vector. Send the colors so that we
3117  know whether what we recv is an owned or halo node. ---*/
3118 
3119  Buffer_Receive_PrimVar = new su2double [nPointTotal_r[iDomain]*(nPrimVar+3)];
3120 
3121  /*--- Receive the buffers with the coords, global index, and colors ---*/
3122 
3123  SU2_MPI::Recv(Buffer_Receive_PrimVar, nPointTotal_r[iDomain]*(nPrimVar+3) , MPI_DOUBLE,
3124  iDomain, rank, MPI_COMM_WORLD, &status_);
3125 
3126  /*--- Loop over all of the points that we have recv'd and store the
3127  coords, global index vertex and markers ---*/
3128 
3129  for (iPoint = 0; iPoint < nPointTotal_r[iDomain]; iPoint++) {
3130 
3131  iGlobal = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+0)]);
3132  iVertex = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+1)]);
3133  iMarker = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+2)]);
3134  for (iVar = 0; iVar < nPrimVar; iVar++)
3135  iPrimVar[iVar] = Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+iVar];
3136 
3137  if (iVertex < 0.0) cout <<" Negative iVertex (receive)" << endl;
3138  if (iMarker < 0.0) cout <<" Negative iMarker (receive)" << endl;
3139 
3140  if (iMarker > nMarker) cout << "ERROR" << endl;
3141  if (iVertex > geometry->nVertex[iMarker]) cout << "ERROR" << endl;
3142 
3143  for (iVar = 0; iVar < nPrimVar; iVar++)
3144  SetDonorPrimVar(iMarker, iVertex, iVar, iPrimVar[iVar]);
3145 
3146  SetDonorGlobalIndex(iMarker, iVertex, iGlobal);
3147 
3148  }
3149 
3150  /*--- Delete memory for recv the point stuff ---*/
3151 
3152  delete [] Buffer_Receive_PrimVar;
3153 
3154 #endif
3155 
3156  }
3157 
3158  }
3159 
3160  /*--- Wait for the non-blocking sends to complete. ---*/
3161 
3162 #ifdef HAVE_MPI
3163 
3165 
3166 #endif
3167 
3168  /*--- Free all of the memory used for communicating points and elements ---*/
3169 
3170  delete[] Buffer_Send_PrimVar;
3171 
3172  /*--- Release all of the temporary memory ---*/
3173 
3174  delete [] nPointTotal_s;
3175  delete [] nPointTotal_r;
3176  delete [] iPrimVar;
3177 
3178 }
3179 
3181 
3182  unsigned long iter, iPoint, iVertex, jVertex, iPointTotal,
3183  Buffer_Send_nPointTotal = 0, iGlobalIndex, iGlobal;
3184  unsigned short iVar, iMarker, jMarker;
3185  long nDomain = 0, iDomain, jDomain;
3186 
3187 #ifdef HAVE_MPI
3188 
3189  /*--- MPI status and request arrays for non-blocking communications ---*/
3190 
3191  SU2_MPI::Status status, status_;
3192 
3193 
3194 #endif
3195 
3196  /*--- Define buffer vector interior domain ---*/
3197 
3198  su2double *Buffer_Send_PrimVar = NULL;
3199  su2double *iPrimVar = new su2double [nPrimVar];
3200 
3201  unsigned long *nPointTotal_s = new unsigned long[size];
3202  unsigned long *nPointTotal_r = new unsigned long[size];
3203 
3204  unsigned long Buffer_Size_PrimVar = 0;
3205  unsigned long PointTotal_Counter = 0;
3206 
3207  /*--- Allocate the memory that we only need if we have MPI support ---*/
3208 
3209  su2double *Buffer_Receive_PrimVar = NULL;
3210 
3211  /*--- Basic dimensionalization ---*/
3212 
3213  nDomain = size;
3214 
3215  /*--- This loop gets the array sizes of points for each
3216  rank to send to each other rank. ---*/
3217 
3218  for (iDomain = 0; iDomain < nDomain; iDomain++) {
3219 
3220  /*--- Loop over the markers to perform the dimensionalizaton
3221  of the domain variables ---*/
3222 
3223  Buffer_Send_nPointTotal = 0;
3224 
3225  /*--- Loop over all of the markers and count the number of each
3226  type of point and element that needs to be sent. ---*/
3227 
3228  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
3229  if (config->GetMarker_All_KindBC(iMarker) == INTERFACE_BOUNDARY) {
3230  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
3231  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
3232  jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
3233  if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
3234  Buffer_Send_nPointTotal++;
3235  }
3236  }
3237  }
3238  }
3239 
3240  /*--- Store the counts on a partition by partition basis. ---*/
3241 
3242  nPointTotal_s[iDomain] = Buffer_Send_nPointTotal;
3243 
3244  /*--- Total counts for allocating send buffers below ---*/
3245 
3246  Buffer_Size_PrimVar += nPointTotal_s[iDomain]*(nPrimVar+3);
3247 
3248  }
3249 
3250  /*--- Allocate the buffer vectors in the appropiate domain (master, iDomain) ---*/
3251 
3252  Buffer_Send_PrimVar = new su2double[Buffer_Size_PrimVar];
3253 
3254  /*--- Now that we know the sizes of the point, we can
3255  allocate and send the information in large chunks to all processors. ---*/
3256 
3257  for (iDomain = 0; iDomain < nDomain; iDomain++) {
3258 
3259  /*--- A rank does not communicate with itself through MPI ---*/
3260 
3261  if (rank != iDomain) {
3262 
3263 #ifdef HAVE_MPI
3264 
3265  /*--- Communicate the counts to iDomain with non-blocking sends ---*/
3266 
3267  SU2_MPI::Bsend(&nPointTotal_s[iDomain], 1, MPI_UNSIGNED_LONG, iDomain, iDomain, MPI_COMM_WORLD);
3268 
3269 #endif
3270 
3271  } else {
3272 
3273  /*--- If iDomain = rank, we simply copy values into place in memory ---*/
3274 
3275  nPointTotal_r[iDomain] = nPointTotal_s[iDomain];
3276 
3277  }
3278 
3279  /*--- Receive the counts. All processors are sending their counters to
3280  iDomain up above, so only iDomain needs to perform the recv here from
3281  all other ranks. ---*/
3282 
3283  if (rank == iDomain) {
3284 
3285  for (jDomain = 0; jDomain < size; jDomain++) {
3286 
3287  /*--- A rank does not communicate with itself through MPI ---*/
3288 
3289  if (rank != jDomain) {
3290 
3291 #ifdef HAVE_MPI
3292 
3293  /*--- Recv the data by probing for the current sender, jDomain,
3294  first and then receiving the values from it. ---*/
3295 
3296  SU2_MPI::Recv(&nPointTotal_r[jDomain], 1, MPI_UNSIGNED_LONG, jDomain, rank, MPI_COMM_WORLD, &status);
3297 
3298 #endif
3299 
3300  }
3301  }
3302 
3303  }
3304  }
3305 
3306  /*--- Wait for the non-blocking sends to complete. ---*/
3307 
3308 #ifdef HAVE_MPI
3309 
3311 
3312 #endif
3313 
3314  /*--- Initialize the counters for the larger send buffers (by domain) ---*/
3315 
3316  PointTotal_Counter = 0;
3317 
3318  for (iDomain = 0; iDomain < nDomain; iDomain++) {
3319 
3320  /*--- Set the value of the interior geometry. Initialize counters. ---*/
3321 
3322  iPointTotal = 0;
3323 
3324  /*--- Load up the actual values into the buffers for sending. ---*/
3325 
3326  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
3327 
3328  if (config->GetMarker_All_KindBC(iMarker) == INTERFACE_BOUNDARY) {
3329 
3330  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
3331 
3332  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
3333  jDomain = geometry->vertex[iMarker][iVertex]->GetDonorProcessor();
3334 
3335  if ((iDomain == jDomain) && (geometry->node[iPoint]->GetDomain())) {
3336 
3337  iGlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
3338  jVertex = geometry->vertex[iMarker][iVertex]->GetDonorVertex();
3339  jMarker = geometry->vertex[iMarker][iVertex]->GetDonorMarker();
3340 
3341  for (iVar = 0; iVar < nPrimVar; iVar++) {
3342  Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+iVar] = node[iPoint]->GetPrimitive(iVar);
3343  }
3344  Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+(nPrimVar+0)] = su2double(iGlobalIndex);
3345  Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+(nPrimVar+1)] = su2double(jVertex);
3346  Buffer_Send_PrimVar[(nPrimVar+3)*(PointTotal_Counter+iPointTotal)+(nPrimVar+2)] = su2double(jMarker);
3347 
3348  iPointTotal++;
3349 
3350  }
3351 
3352  }
3353 
3354  }
3355 
3356  }
3357 
3358  /*--- Send the buffers with the geometrical information ---*/
3359 
3360  if (iDomain != rank) {
3361 
3362 #ifdef HAVE_MPI
3363 
3364  /*--- Communicate the coordinates, global index, colors, and element
3365  date to iDomain with non-blocking sends. ---*/
3366 
3367  SU2_MPI::Bsend(&Buffer_Send_PrimVar[PointTotal_Counter*(nPrimVar+3)],
3368  nPointTotal_s[iDomain]*(nPrimVar+3), MPI_DOUBLE, iDomain,
3369  iDomain, MPI_COMM_WORLD);
3370 
3371 #endif
3372 
3373  }
3374 
3375  else {
3376 
3377  /*--- Allocate local memory for the local recv of the elements ---*/
3378 
3379  Buffer_Receive_PrimVar = new su2double[nPointTotal_s[iDomain]*(nPrimVar+3)];
3380 
3381  for (iter = 0; iter < nPointTotal_s[iDomain]*(nPrimVar+3); iter++)
3382  Buffer_Receive_PrimVar[iter] = Buffer_Send_PrimVar[PointTotal_Counter*(nPrimVar+3)+iter];
3383 
3384  /*--- Recv the point data from ourselves (same procedure as above) ---*/
3385 
3386  for (iPoint = 0; iPoint < nPointTotal_r[iDomain]; iPoint++) {
3387 
3388  iGlobal = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+0)]);
3389  iVertex = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+1)]);
3390  iMarker = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+2)]);
3391  for (iVar = 0; iVar < nPrimVar; iVar++)
3392  iPrimVar[iVar] = Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+iVar];
3393 
3394  if (iVertex < 0.0) cout <<" Negative iVertex (receive)" << endl;
3395  if (iMarker < 0.0) cout <<" Negative iMarker (receive)" << endl;
3396 
3397  for (iVar = 0; iVar < nPrimVar; iVar++)
3398  SetDonorPrimVar(iMarker, iVertex, iVar, iPrimVar[iVar]);
3399 
3400  SetDonorGlobalIndex(iMarker, iVertex, iGlobal);
3401 
3402  }
3403 
3404  /*--- Delete memory for recv the point stuff ---*/
3405 
3406  delete [] Buffer_Receive_PrimVar;
3407 
3408  }
3409 
3410  /*--- Increment the counters for the send buffers (iDomain loop) ---*/
3411 
3412  PointTotal_Counter += iPointTotal;
3413 
3414  }
3415 
3416  /*--- Wait for the non-blocking sends to complete. ---*/
3417 
3418 #ifdef HAVE_MPI
3420 #endif
3421 
3422  /*--- The next section begins the recv of all data for the interior
3423  points/elements in the mesh. First, create the domain structures for
3424  the points on this rank. First, we recv all of the point data ---*/
3425 
3426  for (iDomain = 0; iDomain < size; iDomain++) {
3427 
3428  if (rank != iDomain) {
3429 
3430 #ifdef HAVE_MPI
3431 
3432  /*--- Allocate the receive buffer vector. Send the colors so that we
3433  know whether what we recv is an owned or halo node. ---*/
3434 
3435  Buffer_Receive_PrimVar = new su2double [nPointTotal_r[iDomain]*(nPrimVar+3)];
3436 
3437  /*--- Receive the buffers with the coords, global index, and colors ---*/
3438 
3439  SU2_MPI::Recv(Buffer_Receive_PrimVar, nPointTotal_r[iDomain]*(nPrimVar+3) , MPI_DOUBLE,
3440  iDomain, rank, MPI_COMM_WORLD, &status_);
3441 
3442  /*--- Loop over all of the points that we have recv'd and store the
3443  coords, global index vertex and markers ---*/
3444 
3445  for (iPoint = 0; iPoint < nPointTotal_r[iDomain]; iPoint++) {
3446 
3447  iGlobal = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+0)]);
3448  iVertex = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+1)]);
3449  iMarker = SU2_TYPE::Int(Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+(nPrimVar+2)]);
3450  for (iVar = 0; iVar < nPrimVar; iVar++)
3451  iPrimVar[iVar] = Buffer_Receive_PrimVar[iPoint*(nPrimVar+3)+iVar];
3452 
3453  if (iVertex < 0.0) cout <<" Negative iVertex (receive)" << endl;
3454  if (iMarker < 0.0) cout <<" Negative iMarker (receive)" << endl;
3455 
3456  if (iMarker > nMarker) cout << "ERROR" << endl;
3457  if (iVertex > geometry->nVertex[iMarker]) cout << "ERROR" << endl;
3458 
3459  for (iVar = 0; iVar < nPrimVar; iVar++)
3460  SetDonorPrimVar(iMarker, iVertex, iVar, iPrimVar[iVar]);
3461 
3462  SetDonorGlobalIndex(iMarker, iVertex, iGlobal);
3463 
3464  }
3465 
3466  /*--- Delete memory for recv the point stuff ---*/
3467 
3468  delete [] Buffer_Receive_PrimVar;
3469 
3470 #endif
3471 
3472  }
3473 
3474  }
3475 
3476  /*--- Wait for the non-blocking sends to complete. ---*/
3477 
3478 #ifdef HAVE_MPI
3479 
3481 
3482 #endif
3483 
3484  /*--- Free all of the memory used for communicating points and elements ---*/
3485 
3486  delete[] Buffer_Send_PrimVar;
3487 
3488  /*--- Release all of the temporary memory ---*/
3489 
3490  delete [] nPointTotal_s;
3491  delete [] nPointTotal_r;
3492  delete [] iPrimVar;
3493 
3494 }
3495 
3497  unsigned short iMarker;
3498  unsigned long iVertex, iPoint;
3499  su2double x0, x1, x2, x3;
3500  su2double y0, y1, y2, y3;
3501  su2double eps0, eps1, eps2, eps3;
3502  su2double x, y, eps;
3503 
3504  su2double s[2], a[4], b[4], aa, bb, cc;
3505 
3506  string Marker_Tag;
3507 
3508  /*--- If transpiration used as a DV, use DV values instead ---*/
3509  config->SetTranspirationParams_DV();
3510 
3511  /*--- First initialize all transpiration values to 0 ---*/
3512  for(iPoint = 0; iPoint < geometry->GetnPointDomain(); iPoint++){
3513  node[iPoint]->SetTranspiration(0.0);
3514  }
3515 
3516  for (iMarker = 0; iMarker < nMarker; iMarker++) {
3517  if(config->GetMarker_All_KindBC(iMarker) == TRANSPIRATION){
3518  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
3519  config->GetTranspirationParams(Marker_Tag, x0, x1, x2, x3, y0, y1, y2, y3, eps0, eps1, eps2, eps3);
3520 
3521  if(nDim == 2){
3522  /*--- Linear interpolation in x ---*/
3523  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
3524  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
3525  if (geometry->node[iPoint]->GetDomain()) {
3526  x = geometry->node[iPoint]->GetCoord(0);
3527  if(x >= x0 && x <= x1){
3528  eps = eps0 + (x - x0)*(eps1-eps0)/(x1-x0);
3529  }
3530  else{
3531  eps = 0.0;
3532  }
3533  node[iPoint]->SetTranspiration(eps/config->GetVelocity_Ref());
3534  }
3535  }
3536  }
3537  else{
3538  /*--- Bilinear parametric interpolation ---*/
3539  a[0] = x0; a[1] = -x0+x1; a[2] = -x0+x3; a[3] = x0-x1+x2-x3;
3540  b[0] = y0; b[1] = -y0+y1; b[2] = -y0+y3; b[3] = y0-y1+y2-y3;
3541  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
3542  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
3543  if (geometry->node[iPoint]->GetDomain()) {
3544  x = geometry->node[iPoint]->GetCoord(0);
3545  y = geometry->node[iPoint]->GetCoord(1);
3546 
3547  /*--- Quadratic coefficients ---*/
3548  aa = a[3]*b[2] - a[2]*b[3];
3549  bb = a[3]*b[0] - a[0]*b[3] + a[1]*b[2] - a[2]*b[1] + x*b[3] - y*a[3];
3550  cc = a[1]*b[0] - a[0]*b[1] + x*b[1] - y*a[1];
3551 
3552  /*--- Logical coordinates ---*/
3553  s[1] = (-bb + sqrt(bb*bb - 4.*aa*cc))/(2.*aa);
3554  //if(s[1] < 0.0 || s[1] > 1.0){s[1] = (-bb - sqrt(bb*bb - 4.*aa*cc))/(2.*aa);}
3555  s[0] = (x - a[0] - a[2]*s[1])/(a[1] + a[3]*s[1]);
3556 
3557  if(s[0] >= 0. && s[0] <= 1. && s[1] >= 0.0 && s[1] <= 1.0){
3558  eps = (1.-s[0])*(1.-s[1])*eps0 + s[0]*(1.-s[1])*eps1 + s[0]*s[1]*eps2 + (1.-s[0])*s[1]*eps3;
3559  }
3560  else{
3561  eps = 0.0;
3562  }
3563  node[iPoint]->SetTranspiration(eps/config->GetVelocity_Ref());
3564  }
3565  }
3566  }
3567  }
3568  }
3569 }
3570 
3571 void CEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMesh) {
3572 
3573  su2double Temperature_FreeStream = 0.0, Mach2Vel_FreeStream = 0.0, ModVel_FreeStream = 0.0,
3574  Energy_FreeStream = 0.0, ModVel_FreeStreamND = 0.0, Velocity_Reynolds = 0.0,
3575  Omega_FreeStream = 0.0, Omega_FreeStreamND = 0.0, Viscosity_FreeStream = 0.0,
3576  Density_FreeStream = 0.0, Pressure_FreeStream = 0.0, Tke_FreeStream = 0.0,
3577  Length_Ref = 0.0, Density_Ref = 0.0, Pressure_Ref = 0.0, Velocity_Ref = 0.0,
3578  Temperature_Ref = 0.0, Time_Ref = 0.0, Omega_Ref = 0.0, Force_Ref = 0.0,
3579  Gas_Constant_Ref = 0.0, Viscosity_Ref = 0.0, Conductivity_Ref = 0.0, Energy_Ref= 0.0,
3580  Froude = 0.0, Pressure_FreeStreamND = 0.0, Density_FreeStreamND = 0.0,
3581  Temperature_FreeStreamND = 0.0, Gas_ConstantND = 0.0,
3582  Velocity_FreeStreamND[3] = {0.0, 0.0, 0.0}, Viscosity_FreeStreamND = 0.0,
3583  Tke_FreeStreamND = 0.0, Energy_FreeStreamND = 0.0,
3584  Total_UnstTimeND = 0.0, Delta_UnstTimeND = 0.0, TgammaR = 0.0;
3585 
3586  unsigned short iDim;
3587 
3588  /*--- Local variables ---*/
3589 
3590  su2double Alpha = config->GetAoA()*PI_NUMBER/180.0;
3591  su2double Beta = config->GetAoS()*PI_NUMBER/180.0;
3592  su2double Mach = config->GetMach();
3593  su2double Reynolds = config->GetReynolds();
3594  bool unsteady = (config->GetUnsteady_Simulation() != NO);
3595  bool viscous = config->GetViscous();
3596  bool grid_movement = config->GetGrid_Movement();
3597  bool gravity = config->GetGravityForce();
3598  bool turbulent = (config->GetKind_Solver() == RANS) || (config->GetKind_Solver() == DISC_ADJ_RANS);
3599  bool tkeNeeded = ((turbulent) && (config->GetKind_Turb_Model() == SST));
3600  bool free_stream_temp = (config->GetKind_FreeStreamOption() == TEMPERATURE_FS);
3601  bool reynolds_init = (config->GetKind_InitOption() == REYNOLDS);
3602  bool aeroelastic = config->GetAeroelastic_Simulation();
3603 
3604  /*--- Set temperature via the flutter speed index ---*/
3605  if (aeroelastic) {
3607  su2double w_alpha = config->GetAeroelastic_Frequency_Pitch();
3608  su2double b = config->GetLength_Reynolds()/2.0; // airfoil semichord, Reynolds length is by defaul 1.0
3610  // The temperature times gamma times the gas constant. Depending on the FluidModel temp is calculated below.
3611  TgammaR = ((vf*vf)*(b*b)*(w_alpha*w_alpha)*mu) / (Mach*Mach);
3612  }
3613 
3614  /*--- Compressible non dimensionalization ---*/
3615 
3616  /*--- Compute the Free Stream velocity, using the Mach number ---*/
3617 
3618  Pressure_FreeStream = config->GetPressure_FreeStream();
3619  Density_FreeStream = config->GetDensity_FreeStream();
3620  Temperature_FreeStream = config->GetTemperature_FreeStream();
3621 
3622  switch (config->GetKind_FluidModel()) {
3623 
3624  case STANDARD_AIR:
3625 
3626  if (config->GetSystemMeasurements() == SI) config->SetGas_Constant(287.058);
3627  else if (config->GetSystemMeasurements() == US) config->SetGas_Constant(1716.49);
3628 
3629  FluidModel = new CIdealGas(1.4, config->GetGas_Constant());
3630  if (free_stream_temp) {
3631  if (aeroelastic) {
3632  Temperature_FreeStream = TgammaR / (config->GetGas_Constant()*1.4);
3633  config->SetTemperature_FreeStream(Temperature_FreeStream);
3634  }
3635  FluidModel->SetTDState_PT(Pressure_FreeStream, Temperature_FreeStream);
3636  Density_FreeStream = FluidModel->GetDensity();
3637  config->SetDensity_FreeStream(Density_FreeStream);
3638  }
3639  else {
3640  FluidModel->SetTDState_Prho(Pressure_FreeStream, Density_FreeStream );
3641  Temperature_FreeStream = FluidModel->GetTemperature();
3642  config->SetTemperature_FreeStream(Temperature_FreeStream);
3643  }
3644  break;
3645 
3646  case IDEAL_GAS:
3647 
3648  FluidModel = new CIdealGas(Gamma, config->GetGas_Constant());
3649  if (free_stream_temp) {
3650  FluidModel->SetTDState_PT(Pressure_FreeStream, Temperature_FreeStream);
3651  Density_FreeStream = FluidModel->GetDensity();
3652  config->SetDensity_FreeStream(Density_FreeStream);
3653  }
3654  else {
3655  FluidModel->SetTDState_Prho(Pressure_FreeStream, Density_FreeStream );
3656  Temperature_FreeStream = FluidModel->GetTemperature();
3657  config->SetTemperature_FreeStream(Temperature_FreeStream);
3658  }
3659  break;
3660 
3661  case VW_GAS:
3662 
3664  config->GetPressure_Critical(), config->GetTemperature_Critical());
3665  if (free_stream_temp) {
3666  FluidModel->SetTDState_PT(Pressure_FreeStream, Temperature_FreeStream);
3667  Density_FreeStream = FluidModel->GetDensity();
3668  config->SetDensity_FreeStream(Density_FreeStream);
3669  }
3670  else {
3671  FluidModel->SetTDState_Prho(Pressure_FreeStream, Density_FreeStream );
3672  Temperature_FreeStream = FluidModel->GetTemperature();
3673  config->SetTemperature_FreeStream(Temperature_FreeStream);
3674  }
3675  break;
3676 
3677  case PR_GAS:
3678 
3680  config->GetTemperature_Critical(), config->GetAcentric_Factor());
3681  if (free_stream_temp) {
3682  FluidModel->SetTDState_PT(Pressure_FreeStream, Temperature_FreeStream);
3683  Density_FreeStream = FluidModel->GetDensity();
3684  config->SetDensity_FreeStream(Density_FreeStream);
3685  }
3686  else {
3687  FluidModel->SetTDState_Prho(Pressure_FreeStream, Density_FreeStream );
3688  Temperature_FreeStream = FluidModel->GetTemperature();
3689  config->SetTemperature_FreeStream(Temperature_FreeStream);
3690  }
3691  break;
3692 
3693  }
3694 
3695  Mach2Vel_FreeStream = FluidModel->GetSoundSpeed();
3696 
3697  /*--- Compute the Free Stream velocity, using the Mach number ---*/
3698 
3699  if (nDim == 2) {
3700  config->GetVelocity_FreeStream()[0] = cos(Alpha)*Mach*Mach2Vel_FreeStream;
3701  config->GetVelocity_FreeStream()[1] = sin(Alpha)*Mach*Mach2Vel_FreeStream;
3702  }
3703  if (nDim == 3) {
3704  config->GetVelocity_FreeStream()[0] = cos(Alpha)*cos(Beta)*Mach*Mach2Vel_FreeStream;
3705  config->GetVelocity_FreeStream()[1] = sin(Beta)*Mach*Mach2Vel_FreeStream;
3706  config->GetVelocity_FreeStream()[2] = sin(Alpha)*cos(Beta)*Mach*Mach2Vel_FreeStream;
3707  }
3708 
3709  /*--- Compute the modulus of the free stream velocity ---*/
3710 
3711  ModVel_FreeStream = 0.0;
3712  for (iDim = 0; iDim < nDim; iDim++)
3713  ModVel_FreeStream += config->GetVelocity_FreeStream()[iDim]*config->GetVelocity_FreeStream()[iDim];
3714  ModVel_FreeStream = sqrt(ModVel_FreeStream); config->SetModVel_FreeStream(ModVel_FreeStream);
3715 
3716  /*--- Viscous initialization ---*/
3717 
3718  if (viscous) {
3719 
3720  /*--- The dimensional viscosity is needed to determine the free-stream conditions.
3721  To accomplish this, simply set the non-dimensional coefficients to the
3722  dimensional ones. This will be overruled later.---*/
3723  config->SetMu_RefND(config->GetMu_Ref());
3725  config->SetMu_SND(config->GetMu_S());
3726 
3727  config->SetMu_ConstantND(config->GetMu_Constant());
3728 
3729  /*--- Reynolds based initialization ---*/
3730 
3731  if (reynolds_init) {
3732 
3733  /*--- First, check if there is mesh motion. If yes, use the Mach
3734  number relative to the body to initialize the flow. ---*/
3735 
3736  if (grid_movement) Velocity_Reynolds = config->GetMach_Motion()*Mach2Vel_FreeStream;
3737  else Velocity_Reynolds = ModVel_FreeStream;
3738 
3739  /*--- For viscous flows, pressure will be computed from a density
3740  that is found from the Reynolds number. The viscosity is computed
3741  from the dimensional version of Sutherland's law or the constant
3742  viscosity, depending on the input option.---*/
3743 
3745 
3746  Viscosity_FreeStream = FluidModel->GetLaminarViscosity();
3747  config->SetViscosity_FreeStream(Viscosity_FreeStream);
3748 
3749  Density_FreeStream = Reynolds*Viscosity_FreeStream/(Velocity_Reynolds*config->GetLength_Reynolds());
3750  config->SetDensity_FreeStream(Density_FreeStream);
3751  FluidModel->SetTDState_rhoT(Density_FreeStream, Temperature_FreeStream);
3752  Pressure_FreeStream = FluidModel->GetPressure();
3753  config->SetPressure_FreeStream(Pressure_FreeStream);
3754  Energy_FreeStream = FluidModel->GetStaticEnergy() + 0.5*ModVel_FreeStream*ModVel_FreeStream;
3755 
3756  }
3757 
3758  /*--- Thermodynamics quantities based initialization ---*/
3759 
3760  else {
3761 
3763  Viscosity_FreeStream = FluidModel->GetLaminarViscosity();
3764  config->SetViscosity_FreeStream(Viscosity_FreeStream);
3765  Energy_FreeStream = FluidModel->GetStaticEnergy() + 0.5*ModVel_FreeStream*ModVel_FreeStream;
3766 
3767  }
3768 
3769  /*--- Turbulence kinetic energy ---*/
3770 
3771  Tke_FreeStream = 3.0/2.0*(ModVel_FreeStream*ModVel_FreeStream*config->GetTurbulenceIntensity_FreeStream()*config->GetTurbulenceIntensity_FreeStream());
3772 
3773  }
3774  else {
3775 
3776  /*--- For inviscid flow, energy is calculated from the specified
3777  FreeStream quantities using the proper gas law. ---*/
3778 
3779  Energy_FreeStream = FluidModel->GetStaticEnergy() + 0.5*ModVel_FreeStream*ModVel_FreeStream;
3780 
3781  }
3782 
3783  /*-- Compute the freestream energy. ---*/
3784 
3785  if (tkeNeeded) { Energy_FreeStream += Tke_FreeStream; }; config->SetEnergy_FreeStream(Energy_FreeStream);
3786 
3787  /*--- Compute non dimensional quantities. By definition,
3788  Lref is one because we have converted the grid to meters. ---*/
3789 
3790  if (config->GetRef_NonDim() == DIMENSIONAL) {
3791  Pressure_Ref = 1.0;
3792  Density_Ref = 1.0;
3793  Temperature_Ref = 1.0;
3794  }
3795  else if (config->GetRef_NonDim() == FREESTREAM_PRESS_EQ_ONE) {
3796  Pressure_Ref = Pressure_FreeStream; // Pressure_FreeStream = 1.0
3797  Density_Ref = Density_FreeStream; // Density_FreeStream = 1.0
3798  Temperature_Ref = Temperature_FreeStream; // Temperature_FreeStream = 1.0
3799  }
3800  else if (config->GetRef_NonDim() == FREESTREAM_VEL_EQ_MACH) {
3801  Pressure_Ref = Gamma*Pressure_FreeStream; // Pressure_FreeStream = 1.0/Gamma
3802  Density_Ref = Density_FreeStream; // Density_FreeStream = 1.0
3803  Temperature_Ref = Temperature_FreeStream; // Temp_FreeStream = 1.0
3804  }
3805  else if (config->GetRef_NonDim() == FREESTREAM_VEL_EQ_ONE) {
3806  Pressure_Ref = Mach*Mach*Gamma*Pressure_FreeStream; // Pressure_FreeStream = 1.0/(Gamma*(M_inf)^2)
3807  Density_Ref = Density_FreeStream; // Density_FreeStream = 1.0
3808  Temperature_Ref = Temperature_FreeStream; // Temp_FreeStream = 1.0
3809  }
3810  config->SetPressure_Ref(Pressure_Ref);
3811  config->SetDensity_Ref(Density_Ref);
3812  config->SetTemperature_Ref(Temperature_Ref);
3813 
3814  Length_Ref = 1.0; config->SetLength_Ref(Length_Ref);
3815  Velocity_Ref = sqrt(config->GetPressure_Ref()/config->GetDensity_Ref()); config->SetVelocity_Ref(Velocity_Ref);
3816  Time_Ref = Length_Ref/Velocity_Ref; config->SetTime_Ref(Time_Ref);
3817  Omega_Ref = Velocity_Ref/Length_Ref; config->SetOmega_Ref(Omega_Ref);
3818  Force_Ref = config->GetDensity_Ref()*Velocity_Ref*Velocity_Ref*Length_Ref*Length_Ref; config->SetForce_Ref(Force_Ref);
3819  Gas_Constant_Ref = Velocity_Ref*Velocity_Ref/config->GetTemperature_Ref(); config->SetGas_Constant_Ref(Gas_Constant_Ref);
3820  Viscosity_Ref = config->GetDensity_Ref()*Velocity_Ref*Length_Ref; config->SetViscosity_Ref(Viscosity_Ref);
3821  Conductivity_Ref = Viscosity_Ref*Gas_Constant_Ref; config->SetConductivity_Ref(Conductivity_Ref);
3822  Froude = ModVel_FreeStream/sqrt(STANDARD_GRAVITY*Length_Ref); config->SetFroude(Froude);
3823 
3824  /*--- Divide by reference values, to compute the non-dimensional free-stream values ---*/
3825 
3826  Pressure_FreeStreamND = Pressure_FreeStream/config->GetPressure_Ref(); config->SetPressure_FreeStreamND(Pressure_FreeStreamND);
3827  Density_FreeStreamND = Density_FreeStream/config->GetDensity_Ref(); config->SetDensity_FreeStreamND(Density_FreeStreamND);
3828 
3829  for (iDim = 0; iDim < nDim; iDim++) {
3830  Velocity_FreeStreamND[iDim] = config->GetVelocity_FreeStream()[iDim]/Velocity_Ref; config->SetVelocity_FreeStreamND(Velocity_FreeStreamND[iDim], iDim);
3831  }
3832 
3833  Temperature_FreeStreamND = Temperature_FreeStream/config->GetTemperature_Ref(); config->SetTemperature_FreeStreamND(Temperature_FreeStreamND);
3834 
3835  Gas_ConstantND = config->GetGas_Constant()/Gas_Constant_Ref; config->SetGas_ConstantND(Gas_ConstantND);
3836 
3837 
3838  ModVel_FreeStreamND = 0.0;
3839  for (iDim = 0; iDim < nDim; iDim++) ModVel_FreeStreamND += Velocity_FreeStreamND[iDim]*Velocity_FreeStreamND[iDim];
3840  ModVel_FreeStreamND = sqrt(ModVel_FreeStreamND); config->SetModVel_FreeStreamND(ModVel_FreeStreamND);
3841 
3842  Viscosity_FreeStreamND = Viscosity_FreeStream / Viscosity_Ref; config->SetViscosity_FreeStreamND(Viscosity_FreeStreamND);
3843 
3844  Tke_FreeStream = 3.0/2.0*(ModVel_FreeStream*ModVel_FreeStream*config->GetTurbulenceIntensity_FreeStream()*config->GetTurbulenceIntensity_FreeStream());
3845  config->SetTke_FreeStream(Tke_FreeStream);
3846 
3847  Tke_FreeStreamND = 3.0/2.0*(ModVel_FreeStreamND*ModVel_FreeStreamND*config->GetTurbulenceIntensity_FreeStream()*config->GetTurbulenceIntensity_FreeStream());
3848  config->SetTke_FreeStreamND(Tke_FreeStreamND);
3849 
3850  Omega_FreeStream = Density_FreeStream*Tke_FreeStream/(Viscosity_FreeStream*config->GetTurb2LamViscRatio_FreeStream());
3851  config->SetOmega_FreeStream(Omega_FreeStream);
3852 
3853  Omega_FreeStreamND = Density_FreeStreamND*Tke_FreeStreamND/(Viscosity_FreeStreamND*config->GetTurb2LamViscRatio_FreeStream());
3854  config->SetOmega_FreeStreamND(Omega_FreeStreamND);
3855 
3856  /*--- Initialize the dimensionless Fluid Model that will be used to solve the dimensionless problem ---*/
3857 
3858  /*--- Delete the original (dimensional) FluidModel object before replacing. ---*/
3859 
3860  delete FluidModel;
3861 
3862  switch (config->GetKind_FluidModel()) {
3863 
3864  case STANDARD_AIR:
3865  FluidModel = new CIdealGas(1.4, Gas_ConstantND);
3866  FluidModel->SetEnergy_Prho(Pressure_FreeStreamND, Density_FreeStreamND);
3867  break;
3868 
3869  case IDEAL_GAS:
3870  FluidModel = new CIdealGas(Gamma, Gas_ConstantND);
3871  FluidModel->SetEnergy_Prho(Pressure_FreeStreamND, Density_FreeStreamND);
3872  break;
3873 
3874  case VW_GAS:
3875  FluidModel = new CVanDerWaalsGas(Gamma, Gas_ConstantND, config->GetPressure_Critical() /config->GetPressure_Ref(),
3876  config->GetTemperature_Critical()/config->GetTemperature_Ref());
3877  FluidModel->SetEnergy_Prho(Pressure_FreeStreamND, Density_FreeStreamND);
3878  break;
3879 
3880  case PR_GAS:
3881  FluidModel = new CPengRobinson(Gamma, Gas_ConstantND, config->GetPressure_Critical() /config->GetPressure_Ref(),
3882  config->GetTemperature_Critical()/config->GetTemperature_Ref(), config->GetAcentric_Factor());
3883  FluidModel->SetEnergy_Prho(Pressure_FreeStreamND, Density_FreeStreamND);
3884  break;
3885 
3886  }
3887 
3888  Energy_FreeStreamND = FluidModel->GetStaticEnergy() + 0.5*ModVel_FreeStreamND*ModVel_FreeStreamND;
3889 
3890  if (viscous) {
3891 
3892  /*--- Constant viscosity model ---*/
3893  config->SetMu_ConstantND(config->GetMu_Constant()/Viscosity_Ref);
3894 
3895  /*--- Sutherland's model ---*/
3896 
3897  config->SetMu_RefND(config->GetMu_Ref()/Viscosity_Ref);
3898  config->SetMu_SND(config->GetMu_S()/config->GetTemperature_Ref());
3900 
3901  /* constant thermal conductivity model */
3902  config->SetKt_ConstantND(config->GetKt_Constant()/Conductivity_Ref);
3903 
3906 
3907  }
3908 
3909  if (tkeNeeded) { Energy_FreeStreamND += Tke_FreeStreamND; }; config->SetEnergy_FreeStreamND(Energy_FreeStreamND);
3910 
3911  Energy_Ref = Energy_FreeStream/Energy_FreeStreamND; config->SetEnergy_Ref(Energy_Ref);
3912 
3913  Total_UnstTimeND = config->GetTotal_UnstTime() / Time_Ref; config->SetTotal_UnstTimeND(Total_UnstTimeND);
3914  Delta_UnstTimeND = config->GetDelta_UnstTime() / Time_Ref; config->SetDelta_UnstTimeND(Delta_UnstTimeND);
3915 
3916  /*--- Write output to the console if this is the master node and first domain ---*/
3917 
3918  if ((rank == MASTER_NODE) && (iMesh == MESH_0)) {
3919 
3920  cout.precision(6);
3921 
3922  if (viscous) {
3923  cout << "Viscous flow: Computing pressure using the ideal gas law" << endl;
3924  cout << "based on the free-stream temperature and a density computed" << endl;
3925  cout << "from the Reynolds number." << endl;
3926  } else {
3927  cout << "Inviscid flow: Computing density based on free-stream" << endl;
3928  cout << "temperature and pressure using the ideal gas law." << endl;
3929  }
3930 
3931  if (grid_movement) cout << "Force coefficients computed using MACH_MOTION." << endl;
3932  else cout << "Force coefficients computed using free-stream values." << endl;
3933 
3934  cout <<"-- Input conditions:"<< endl;
3935 
3936  switch (config->GetKind_FluidModel()) {
3937 
3938  case STANDARD_AIR:
3939  cout << "Fluid Model: STANDARD_AIR "<< endl;
3940  cout << "Specific gas constant: " << config->GetGas_Constant();
3941  if (config->GetSystemMeasurements() == SI) cout << " N.m/kg.K." << endl;
3942  else if (config->GetSystemMeasurements() == US) cout << " lbf.ft/slug.R." << endl;
3943  cout << "Specific gas constant (non-dim): " << config->GetGas_ConstantND()<< endl;
3944  cout << "Specific Heat Ratio: "<< Gamma << endl;
3945  break;
3946 
3947  case IDEAL_GAS:
3948  cout << "Fluid Model: IDEAL_GAS "<< endl;
3949  cout << "Specific gas constant: " << config->GetGas_Constant() << " N.m/kg.K." << endl;
3950  cout << "Specific gas constant (non-dim): " << config->GetGas_ConstantND()<< endl;
3951  cout << "Specific Heat Ratio: "<< Gamma << endl;
3952  break;
3953 
3954  case VW_GAS:
3955  cout << "Fluid Model: Van der Waals "<< endl;
3956  cout << "Specific gas constant: " << config->GetGas_Constant() << " N.m/kg.K." << endl;
3957  cout << "Specific gas constant (non-dim): " << config->GetGas_ConstantND()<< endl;
3958  cout << "Specific Heat Ratio: "<< Gamma << endl;
3959  cout << "Critical Pressure: " << config->GetPressure_Critical() << " Pa." << endl;
3960  cout << "Critical Temperature: " << config->GetTemperature_Critical() << " K." << endl;
3961  cout << "Critical Pressure (non-dim): " << config->GetPressure_Critical() /config->GetPressure_Ref() << endl;
3962  cout << "Critical Temperature (non-dim) : " << config->GetTemperature_Critical() /config->GetTemperature_Ref() << endl;
3963  break;
3964 
3965  case PR_GAS:
3966  cout << "Fluid Model: Peng-Robinson "<< endl;
3967  cout << "Specific gas constant: " << config->GetGas_Constant() << " N.m/kg.K." << endl;
3968  cout << "Specific gas constant (non-dim): " << config->GetGas_ConstantND()<< endl;
3969  cout << "Specific Heat Ratio: "<< Gamma << endl;
3970  cout << "Critical Pressure: " << config->GetPressure_Critical() << " Pa." << endl;
3971  cout << "Critical Temperature: " << config->GetTemperature_Critical() << " K." << endl;
3972  cout << "Critical Pressure (non-dim): " << config->GetPressure_Critical() /config->GetPressure_Ref() << endl;
3973  cout << "Critical Temperature (non-dim) : " << config->GetTemperature_Critical() /config->GetTemperature_Ref() << endl;
3974  break;
3975 
3976  }
3977  if (viscous) {
3978  switch (config->GetKind_ViscosityModel()) {
3979 
3980  case CONSTANT_VISCOSITY:
3981  cout << "Viscosity Model: CONSTANT_VISCOSITY "<< endl;
3982  cout << "Laminar Viscosity: " << config->GetMu_Constant();
3983  if (config->GetSystemMeasurements() == SI) cout << " N.s/m^2." << endl;
3984  else if (config->GetSystemMeasurements() == US) cout << " lbf.s/ft^2." << endl;
3985  cout << "Laminar Viscosity (non-dim): " << config->GetMu_ConstantND()<< endl;
3986  break;
3987 
3988  case SUTHERLAND:
3989  cout << "Viscosity Model: SUTHERLAND "<< endl;
3990  cout << "Ref. Laminar Viscosity: " << config->GetMu_Ref();
3991  if (config->GetSystemMeasurements() == SI) cout << " N.s/m^2." << endl;
3992  else if (config->GetSystemMeasurements() == US) cout << " lbf.s/ft^2." << endl;
3993  cout << "Ref. Temperature: " << config->GetMu_Temperature_Ref();
3994  if (config->GetSystemMeasurements() == SI) cout << " K." << endl;
3995  else if (config->GetSystemMeasurements() == US) cout << " R." << endl;
3996  cout << "Sutherland Constant: "<< config->GetMu_S();
3997  if (config->GetSystemMeasurements() == SI) cout << " K." << endl;
3998  else if (config->GetSystemMeasurements() == US) cout << " R." << endl;
3999  cout << "Laminar Viscosity (non-dim): " << config->GetMu_ConstantND()<< endl;
4000  cout << "Ref. Temperature (non-dim): " << config->GetMu_Temperature_RefND()<< endl;
4001  cout << "Sutherland constant (non-dim): "<< config->GetMu_SND()<< endl;
4002  break;
4003 
4004  }
4005  switch (config->GetKind_ConductivityModel()) {
4006 
4007  case CONSTANT_PRANDTL:
4008  cout << "Conductivity Model: CONSTANT_PRANDTL "<< endl;
4009  cout << "Prandtl: " << config->GetPrandtl_Lam()<< endl;
4010  break;
4011 
4012  case CONSTANT_CONDUCTIVITY:
4013  cout << "Conductivity Model: CONSTANT_CONDUCTIVITY "<< endl;
4014  cout << "Molecular Conductivity: " << config->GetKt_Constant()<< " W/m^2.K." << endl;
4015  cout << "Molecular Conductivity (non-dim): " << config->GetKt_ConstantND()<< endl;
4016  break;
4017 
4018  }
4019  }
4020 
4021 
4022  cout << "Free-stream static pressure: " << config->GetPressure_FreeStream();
4023  if (config->GetSystemMeasurements() == SI) cout << " Pa." << endl;
4024  else if (config->GetSystemMeasurements() == US) cout << " psf." << endl;
4025 
4026  cout << "Free-stream total pressure: " << config->GetPressure_FreeStream() * pow( 1.0+Mach*Mach*0.5*(Gamma-1.0), Gamma/(Gamma-1.0) );
4027  if (config->GetSystemMeasurements() == SI) cout << " Pa." << endl;
4028  else if (config->GetSystemMeasurements() == US) cout << " psf." << endl;
4029 
4030  cout << "Free-stream temperature: " << config->GetTemperature_FreeStream();
4031  if (config->GetSystemMeasurements() == SI) cout << " K." << endl;
4032  else if (config->GetSystemMeasurements() == US) cout << " R." << endl;
4033 
4034  cout << "Free-stream density: " << config->GetDensity_FreeStream();
4035  if (config->GetSystemMeasurements() == SI) cout << " kg/m^3." << endl;
4036  else if (config->GetSystemMeasurements() == US) cout << " slug/ft^3." << endl;
4037 
4038  if (nDim == 2) {
4039  cout << "Free-stream velocity: (" << config->GetVelocity_FreeStream()[0] << ", ";
4040  cout << config->GetVelocity_FreeStream()[1] << ")";
4041  }
4042  if (nDim == 3) {
4043  cout << "Free-stream velocity: (" << config->GetVelocity_FreeStream()[0] << ", ";
4044  cout << config->GetVelocity_FreeStream()[1] << ", " << config->GetVelocity_FreeStream()[2] << ")";
4045  }
4046  if (config->GetSystemMeasurements() == SI) cout << " m/s. ";
4047  else if (config->GetSystemMeasurements() == US) cout << " ft/s. ";
4048 
4049  cout << "Magnitude: " << config->GetModVel_FreeStream();
4050  if (config->GetSystemMeasurements() == SI) cout << " m/s (" << config->GetModVel_FreeStream()*1.94384 << " KTS)." << endl;
4051  else if (config->GetSystemMeasurements() == US) cout << " ft/s (" << config->GetModVel_FreeStream()*0.592484 << " KTS)." << endl;
4052 
4053  cout << "Free-stream total energy per unit mass: " << config->GetEnergy_FreeStream();
4054  if (config->GetSystemMeasurements() == SI) cout << " m^2/s^2." << endl;
4055  else if (config->GetSystemMeasurements() == US) cout << " ft^2/s^2." << endl;
4056 
4057  if (viscous) {
4058  cout << "Free-stream viscosity: " << config->GetViscosity_FreeStream();
4059  if (config->GetSystemMeasurements() == SI) cout << " N.s/m^2." << endl;
4060  else if (config->GetSystemMeasurements() == US) cout << " lbf.s/ft^2." << endl;
4061  if (turbulent) {
4062  cout << "Free-stream turb. kinetic energy per unit mass: " << config->GetTke_FreeStream();
4063  if (config->GetSystemMeasurements() == SI) cout << " m^2/s^2." << endl;
4064  else if (config->GetSystemMeasurements() == US) cout << " ft^2/s^2." << endl;
4065  cout << "Free-stream specific dissipation: " << config->GetOmega_FreeStream();
4066  if (config->GetSystemMeasurements() == SI) cout << " 1/s." << endl;
4067  else if (config->GetSystemMeasurements() == US) cout << " 1/s." << endl;
4068  }
4069  }
4070 
4071  if (unsteady) { cout << "Total time: " << config->GetTotal_UnstTime() << " s. Time step: " << config->GetDelta_UnstTime() << " s." << endl; }
4072 
4073  /*--- Print out reference values. ---*/
4074 
4075  cout <<"-- Reference values:"<< endl;
4076 
4077  cout << "Reference specific gas constant: " << config->GetGas_Constant_Ref();
4078  if (config->GetSystemMeasurements() == SI) cout << " N.m/kg.K." << endl;
4079  else if (config->GetSystemMeasurements() == US) cout << " lbf.ft/slug.R." << endl;
4080 
4081  cout << "Reference pressure: " << config->GetPressure_Ref();
4082  if (config->GetSystemMeasurements() == SI) cout << " Pa." << endl;
4083  else if (config->GetSystemMeasurements() == US) cout << " psf." << endl;
4084 
4085  cout << "Reference temperature: " << config->GetTemperature_Ref();
4086  if (config->GetSystemMeasurements() == SI) cout << " K." << endl;
4087  else if (config->GetSystemMeasurements() == US) cout << " R." << endl;
4088 
4089  cout << "Reference density: " << config->GetDensity_Ref();
4090  if (config->GetSystemMeasurements() == SI) cout << " kg/m^3." << endl;
4091  else if (config->GetSystemMeasurements() == US) cout << " slug/ft^3." << endl;
4092 
4093  cout << "Reference velocity: " << config->GetVelocity_Ref();
4094  if (config->GetSystemMeasurements() == SI) cout << " m/s." << endl;
4095  else if (config->GetSystemMeasurements() == US) cout << " ft/s." << endl;
4096 
4097  cout << "Reference energy per unit mass: " << config->GetEnergy_Ref();
4098  if (config->GetSystemMeasurements() == SI) cout << " m^2/s^2." << endl;
4099  else if (config->GetSystemMeasurements() == US) cout << " ft^2/s^2." << endl;
4100 
4101  if (viscous) {
4102  cout << "Reference viscosity: " << config->GetViscosity_Ref();
4103  if (config->GetSystemMeasurements() == SI) cout << " N.s/m^2." << endl;
4104  else if (config->GetSystemMeasurements() == US) cout << " lbf.s/ft^2." << endl;
4105  cout << "Reference conductivity: " << config->GetConductivity_Ref();
4106  if (config->GetSystemMeasurements() == SI) cout << " W/m^2.K." << endl;
4107  else if (config->GetSystemMeasurements() == US) cout << " lbf/ft.s.R." << endl;
4108  }
4109 
4110 
4111  if (unsteady) cout << "Reference time: " << config->GetTime_Ref() <<" s." << endl;
4112 
4113  /*--- Print out resulting non-dim values here. ---*/
4114 
4115  cout << "-- Resulting non-dimensional state:" << endl;
4116  cout << "Mach number (non-dim): " << config->GetMach() << endl;
4117  if (viscous) {
4118  cout << "Reynolds number (non-dim): " << config->GetReynolds() <<". Re length: " << config->GetLength_Reynolds();
4119  if (config->GetSystemMeasurements() == SI) cout << " m." << endl;
4120  else if (config->GetSystemMeasurements() == US) cout << " ft." << endl;
4121  }
4122  if (gravity) {
4123  cout << "Froude number (non-dim): " << Froude << endl;
4124  cout << "Lenght of the baseline wave (non-dim): " << 2.0*PI_NUMBER*Froude*Froude << endl;
4125  }
4126 
4127  cout << "Specific gas constant (non-dim): " << config->GetGas_ConstantND() << endl;
4128  cout << "Free-stream temperature (non-dim): " << config->GetTemperature_FreeStreamND() << endl;
4129 
4130  cout << "Free-stream pressure (non-dim): " << config->GetPressure_FreeStreamND() << endl;
4131 
4132  cout << "Free-stream density (non-dim): " << config->GetDensity_FreeStreamND() << endl;
4133 
4134  if (nDim == 2) {
4135  cout << "Free-stream velocity (non-dim): (" << config->GetVelocity_FreeStreamND()[0] << ", ";
4136  cout << config->GetVelocity_FreeStreamND()[1] << "). ";
4137  } else {
4138  cout << "Free-stream velocity (non-dim): (" << config->GetVelocity_FreeStreamND()[0] << ", ";
4139  cout << config->GetVelocity_FreeStreamND()[1] << ", " << config->GetVelocity_FreeStreamND()[2] << "). ";
4140  }
4141  cout << "Magnitude: " << config->GetModVel_FreeStreamND() << endl;
4142 
4143  cout << "Free-stream total energy per unit mass (non-dim): " << config->GetEnergy_FreeStreamND() << endl;
4144 
4145  if (viscous) {
4146  cout << "Free-stream viscosity (non-dim): " << config->GetViscosity_FreeStreamND() << endl;
4147  if (turbulent) {
4148  cout << "Free-stream turb. kinetic energy (non-dim): " << config->GetTke_FreeStreamND() << endl;
4149  cout << "Free-stream specific dissipation (non-dim): " << config->GetOmega_FreeStreamND() << endl;
4150  }
4151  }
4152 
4153  if (unsteady) {
4154  cout << "Total time (non-dim): " << config->GetTotal_UnstTimeND() << endl;
4155  cout << "Time step (non-dim): " << config->GetDelta_UnstTimeND() << endl;
4156  }
4157 
4158  cout << endl;
4159 
4160  }
4161 
4162 }
4163 
4164 void CEulerSolver::SetInitialCondition(CGeometry **geometry, CSolver ***solver_container, CConfig *config, unsigned long ExtIter) {
4165 
4166  unsigned long iPoint;
4167  unsigned short iMesh, iDim;
4168  su2double X0[3] = {0.0,0.0,0.0}, X1[3] = {0.0,0.0,0.0}, X2[3] = {0.0,0.0,0.0},
4169  X1_X0[3] = {0.0,0.0,0.0}, X2_X0[3] = {0.0,0.0,0.0}, X2_X1[3] = {0.0,0.0,0.0},
4170  CP[3] = {0.0,0.0,0.0}, Distance, DotCheck, Radius;
4171 
4172  unsigned short nDim = geometry[MESH_0]->GetnDim();
4173  bool restart = (config->GetRestart() || config->GetRestart_Flow());
4174  bool rans = ((config->GetKind_Solver() == RANS) ||
4175  (config->GetKind_Solver() == ADJ_RANS) ||
4176  (config->GetKind_Solver() == DISC_ADJ_RANS));
4177  bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) ||
4178  (config->GetUnsteady_Simulation() == DT_STEPPING_2ND));
4179  bool SubsonicEngine = config->GetSubsonicEngine();
4180 
4181  /*--- Set subsonic initial condition for engine intakes ---*/
4182 
4183  if (SubsonicEngine) {
4184 
4185  /*--- Set initial boundary condition at iteration 0 ---*/
4186 
4187  if ((ExtIter == 0) && (!restart)) {
4188 
4189  su2double Velocity_Cyl[3] = {0.0, 0.0, 0.0}, Velocity_CylND[3] = {0.0, 0.0, 0.0}, Viscosity_Cyl,
4190  Density_Cyl, Density_CylND, Pressure_CylND, ModVel_Cyl, ModVel_CylND, Energy_CylND,
4191  T_ref = 0.0, S = 0.0, Mu_ref = 0.0, *Coord, *SubsonicEngine_Cyl, *SubsonicEngine_Values;
4192 
4193  SubsonicEngine_Values = config->GetSubsonicEngine_Values();
4194  su2double Mach_Cyl = SubsonicEngine_Values[0];
4195  su2double Alpha_Cyl = SubsonicEngine_Values[1];
4196  su2double Beta_Cyl = SubsonicEngine_Values[2];
4197  su2double Pressure_Cyl = SubsonicEngine_Values[3];
4198  su2double Temperature_Cyl = SubsonicEngine_Values[4];
4199 
4200  su2double Alpha = Alpha_Cyl*PI_NUMBER/180.0;
4201  su2double Beta = Beta_Cyl*PI_NUMBER/180.0;
4202 
4204  su2double Gas_Constant = config->GetGas_Constant();
4205 
4206  su2double Mach2Vel_Cyl = sqrt(Gamma*Gas_Constant*Temperature_Cyl);
4207 
4208  for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) {
4209 
4210  for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
4211 
4212  Velocity_Cyl[0] = cos(Alpha)*cos(Beta)*Mach_Cyl*Mach2Vel_Cyl;
4213  Velocity_Cyl[1] = sin(Beta)*Mach_Cyl*Mach2Vel_Cyl;
4214  Velocity_Cyl[2] = sin(Alpha)*cos(Beta)*Mach_Cyl*Mach2Vel_Cyl;
4215 
4216  ModVel_Cyl = 0.0;
4217  for (iDim = 0; iDim < nDim; iDim++) {
4218  ModVel_Cyl += Velocity_Cyl[iDim]*Velocity_Cyl[iDim];
4219  }
4220  ModVel_Cyl = sqrt(ModVel_Cyl);
4221 
4222  if (config->GetViscous()) {
4223  if (config->GetSystemMeasurements() == SI) { T_ref = 273.15; S = 110.4; Mu_ref = 1.716E-5; }
4224  if (config->GetSystemMeasurements() == US) {
4225  T_ref = (273.15 - 273.15) * 1.8 + 491.67;
4226  S = (110.4 - 273.15) * 1.8 + 491.67;
4227  Mu_ref = 1.716E-5/47.88025898;
4228  }
4229  Viscosity_Cyl = Mu_ref*(pow(Temperature_Cyl/T_ref, 1.5) * (T_ref+S)/(Temperature_Cyl+S));
4230  Density_Cyl = config->GetReynolds()*Viscosity_Cyl/(ModVel_Cyl*config->GetLength_Reynolds());
4231  Pressure_Cyl = Density_Cyl*Gas_Constant*Temperature_Cyl;
4232  }
4233  else {
4234  Density_Cyl = Pressure_Cyl/(Gas_Constant*Temperature_Cyl);
4235  }
4236 
4237  Density_CylND = Density_Cyl/config->GetDensity_Ref();
4238  Pressure_CylND = Pressure_Cyl/config->GetPressure_Ref();
4239 
4240  for (iDim = 0; iDim < nDim; iDim++) {
4241  Velocity_CylND[iDim] = Velocity_Cyl[iDim]/config->GetVelocity_Ref();
4242  }
4243 
4244  ModVel_CylND = 0.0;
4245  for (iDim = 0; iDim < nDim; iDim++) {
4246  ModVel_CylND += Velocity_CylND[iDim]*Velocity_CylND[iDim];
4247  }
4248  ModVel_CylND = sqrt(ModVel_CylND);
4249 
4250  Energy_CylND = Pressure_CylND/(Density_CylND*Gamma_Minus_One)+0.5*ModVel_CylND*ModVel_CylND;
4251 
4252  Coord = geometry[iMesh]->node[iPoint]->GetCoord();
4253 
4254  SubsonicEngine_Cyl = config->GetSubsonicEngine_Cyl();
4255 
4256  X0[0] = Coord[0]; X0[1] = Coord[1]; X0[2] = Coord[2];
4257  X1[0] = SubsonicEngine_Cyl[0]; X1[1] = SubsonicEngine_Cyl[1]; X1[2] = SubsonicEngine_Cyl[2];
4258  X2[0] = SubsonicEngine_Cyl[3]; X2[1] = SubsonicEngine_Cyl[4]; X2[2] = SubsonicEngine_Cyl[5];
4259  Radius = SubsonicEngine_Cyl[6];
4260 
4261  for (iDim = 0; iDim < nDim; iDim++) {
4262  X2_X1[iDim]= X1[iDim] - X2[iDim];
4263  X1_X0[iDim]= X0[iDim] - X1[iDim];
4264  X2_X0[iDim]= X0[iDim] - X2[iDim];
4265  }
4266 
4267  CP[0] = (X2_X1[1]*X1_X0[2] - X2_X1[2]*X1_X0[1]);
4268  CP[1] = (X2_X1[2]*X1_X0[0] - X2_X1[0]*X1_X0[2]);
4269  CP[2] = (X2_X1[0]*X1_X0[1] - X2_X1[1]*X1_X0[0]);
4270 
4271  Distance = sqrt((CP[0]*CP[0]+CP[1]*CP[1]+CP[2]*CP[2])/(X2_X1[0]*X2_X1[0]+X2_X1[1]*X2_X1[1]+X2_X1[2]*X2_X1[2]));
4272 
4273  DotCheck = -(X1_X0[0]*X2_X1[0]+X1_X0[1]*X2_X1[1]+X1_X0[2]*X2_X1[2]);
4274  if (DotCheck < 0.0) Distance = sqrt(X1_X0[0]*X1_X0[0]+X1_X0[1]*X1_X0[1]+X1_X0[2]*X1_X0[2]);
4275 
4276  DotCheck = (X2_X0[0]*X2_X1[0]+X2_X0[1]*X2_X1[1]+X2_X0[2]*X2_X1[2]);
4277  if (DotCheck < 0.0) Distance = sqrt(X2_X0[0]*X2_X0[0]+X2_X0[1]*X2_X0[1]+X2_X0[2]*X2_X0[2]);
4278 
4279  if (Distance < Radius) {
4280 
4281  solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(0, Density_CylND);
4282  for (iDim = 0; iDim < nDim; iDim++)
4283  solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(iDim+1, Density_CylND*Velocity_CylND[iDim]);
4284  solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(nVar-1, Density_CylND*Energy_CylND);
4285 
4286  solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution_Old(0, Density_CylND);
4287  for (iDim = 0; iDim < nDim; iDim++)
4288  solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution_Old(iDim+1, Density_CylND*Velocity_CylND[iDim]);
4289  solver_container[iMesh][FLOW_SOL]->node[iPoint]->SetSolution_Old(nVar-1, Density_CylND*Energy_CylND);
4290 
4291  }
4292 
4293  }
4294 
4295  /*--- Set the MPI communication ---*/
4296 
4297  solver_container[iMesh][FLOW_SOL]->Set_MPI_Solution(geometry[iMesh], config);
4298  solver_container[iMesh][FLOW_SOL]->Set_MPI_Solution_Old(geometry[iMesh], config);
4299 
4300  }
4301 
4302  }
4303 
4304  }
4305 
4306  /*--- Make sure that the solution is well initialized for unsteady
4307  calculations with dual time-stepping (load additional restarts for 2nd-order). ---*/
4308 
4309  if (dual_time && (ExtIter == 0 || (restart && (long)ExtIter == config->GetUnst_RestartIter()))) {
4310 
4311  /*--- Push back the initial condition to previous solution containers
4312  for a 1st-order restart or when simply intitializing to freestream. ---*/
4313 
4314  for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) {
4315  for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
4316  solver_container[iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n();
4317  solver_container[iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n1();
4318  if (rans) {
4319  solver_container[iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n();
4320  solver_container[iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n1();
4321  }
4322  }
4323  }
4324 
4325  if ((restart && (long)ExtIter == config->GetUnst_RestartIter()) &&
4326  (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)) {
4327 
4328  /*--- Load an additional restart file for a 2nd-order restart ---*/
4329 
4330  solver_container[MESH_0][FLOW_SOL]->LoadRestart(geometry, solver_container, config, SU2_TYPE::Int(config->GetUnst_RestartIter()-1), true);
4331 
4332  /*--- Load an additional restart file for the turbulence model ---*/
4333  if (rans)
4334  solver_container[MESH_0][TURB_SOL]->LoadRestart(geometry, solver_container, config, SU2_TYPE::Int(config->GetUnst_RestartIter()-1), false);
4335 
4336  /*--- Push back this new solution to time level N. ---*/
4337 
4338  for (iMesh = 0; iMesh <= config->GetnMGLevels(); iMesh++) {
4339  for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
4340  solver_container[iMesh][FLOW_SOL]->node[iPoint]->Set_Solution_time_n();
4341  if (rans) {
4342  solver_container[iMesh][TURB_SOL]->node[iPoint]->Set_Solution_time_n();
4343  }
4344  }
4345  }
4346  }
4347  }
4348 
4349 }
4350 
4351 void CEulerSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) {
4352 
4353  unsigned long ErrorCounter = 0;
4354 
4355  unsigned long ExtIter = config->GetExtIter();
4356  bool cont_adjoint = config->GetContinuous_Adjoint();
4357  bool disc_adjoint = config->GetDiscrete_Adjoint();
4358  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
4359  bool muscl = (config->GetMUSCL_Flow() || (cont_adjoint && config->GetKind_ConvNumScheme_AdjFlow() == ROE));
4360  bool limiter = ((config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (ExtIter <= config->GetLimiterIter()) && !(disc_adjoint && config->GetFrozen_Limiter_Disc()));
4361  bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) || (cont_adjoint && config->GetKind_ConvNumScheme_AdjFlow() == SPACE_CENTERED);
4362  bool center_jst = center && (config->GetKind_Centered_Flow() == JST);
4363  bool engine = ((config->GetnMarker_EngineInflow() != 0) || (config->GetnMarker_EngineExhaust() != 0));
4364  bool actuator_disk = ((config->GetnMarker_ActDiskInlet() != 0) || (config->GetnMarker_ActDiskOutlet() != 0));
4365  bool nearfield = (config->GetnMarker_NearFieldBound() != 0);
4366  bool interface = (config->GetnMarker_InterfaceBound() != 0);
4367  bool fixed_cl = config->GetFixed_CL_Mode();
4368  bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE;
4369  unsigned short kind_row_dissipation = config->GetKind_RoeLowDiss();
4370  bool roe_low_dissipation = (kind_row_dissipation != NO_ROELOWDISS) && (config->GetKind_Upwind_Flow() == ROE);
4371 
4372  /*--- Update the angle of attack at the far-field for fixed CL calculations (only direct problem). ---*/
4373 
4374  if ((fixed_cl) && (!disc_adjoint) && (!cont_adjoint)) { SetFarfield_AoA(geometry, solver_container, config, iMesh, Output); }
4375 
4376  /*--- Set the primitive variables ---*/
4377 
4378  ErrorCounter = SetPrimitive_Variables(solver_container, config, Output);
4379 
4380  /*--- Compute the engine properties ---*/
4381 
4382  if (engine) { GetPower_Properties(geometry, config, iMesh, Output); }
4383 
4384  /*--- Compute the actuator disk properties and distortion levels ---*/
4385 
4386  if (actuator_disk) {
4387  Set_MPI_ActDisk(solver_container, geometry, config);
4388  GetPower_Properties(geometry, config, iMesh, Output);
4389  SetActDisk_BCThrust(geometry, solver_container, config, iMesh, Output);
4390  }
4391 
4392  /*--- Compute Interface MPI ---*/
4393 
4394  if (interface) { Set_MPI_Interface(geometry, config); }
4395 
4396  /*--- Compute NearField MPI ---*/
4397 
4398  if (nearfield) { Set_MPI_Nearfield(geometry, config); }
4399 
4400 
4401  /*--- Upwind second order reconstruction ---*/
4402 
4403  if ((muscl && !center) && (iMesh == MESH_0) && !Output) {
4404 
4405  /*--- Gradient computation ---*/
4406 
4407  if (config->GetKind_Gradient_Method() == GREEN_GAUSS) {
4408  SetPrimitive_Gradient_GG(geometry, config);
4409  }
4411  SetPrimitive_Gradient_LS(geometry, config);
4412  }
4413 
4414  /*--- Limiter computation ---*/
4415 
4416  if (limiter && (iMesh == MESH_0)
4417  && !Output && !van_albada) { SetPrimitive_Limiter(geometry, config); }
4418 
4419  }
4420 
4421  /*--- Artificial dissipation ---*/
4422 
4423  if (center && !Output) {
4424  SetMax_Eigenvalue(geometry, config);
4425  if ((center_jst) && (iMesh == MESH_0)) {
4426  SetCentered_Dissipation_Sensor(geometry, config);
4427  SetUndivided_Laplacian(geometry, config);
4428  }
4429  }
4430 
4431  /*--- Roe Low Dissipation Sensor ---*/
4432 
4433  if (roe_low_dissipation){
4434  SetRoe_Dissipation(geometry, config);
4435  if (kind_row_dissipation == FD_DUCROS || kind_row_dissipation == NTS_DUCROS){
4436  SetUpwind_Ducros_Sensor(geometry, config);
4437  }
4438  }
4439 
4440  /*--- Initialize the Jacobian matrices ---*/
4441 
4442  if (implicit && !disc_adjoint) Jacobian.SetValZero();
4443 
4444  /*--- Error message ---*/
4445 
4446  if (config->GetConsole_Output_Verb() == VERB_HIGH) {
4447 #ifdef HAVE_MPI
4448  unsigned long MyErrorCounter = ErrorCounter; ErrorCounter = 0;
4449  SU2_MPI::Allreduce(&MyErrorCounter, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD);
4450 #endif
4451  if (iMesh == MESH_0) config->SetNonphysical_Points(ErrorCounter);
4452  }
4453 
4454 }
4455 
4456 void CEulerSolver::Postprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config,
4457  unsigned short iMesh) { }
4458 
4459 unsigned long CEulerSolver::SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output) {
4460 
4461  unsigned long iPoint, ErrorCounter = 0;
4462  bool RightSol = true;
4463 
4464  for (iPoint = 0; iPoint < nPoint; iPoint ++) {
4465 
4466  /*--- Initialize the non-physical points vector ---*/
4467 
4468  node[iPoint]->SetNon_Physical(false);
4469 
4470  /*--- Compressible flow, primitive variables nDim+5, (T, vx, vy, vz, P, rho, h, c, lamMu, eddyMu, ThCond, Cp) ---*/
4471 
4472  RightSol = node[iPoint]->SetPrimVar(FluidModel);
4473  node[iPoint]->SetSecondaryVar(FluidModel);
4474 
4475  if (!RightSol) { node[iPoint]->SetNon_Physical(true); ErrorCounter++; }
4476 
4477  /*--- Initialize the convective, source and viscous residual vector ---*/
4478 
4479  if (!Output) LinSysRes.SetBlock_Zero(iPoint);
4480 
4481  }
4482 
4483  return ErrorCounter;
4484 }
4485 void CEulerSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config,
4486  unsigned short iMesh, unsigned long Iteration) {
4487 
4488  su2double *Normal, Area, Vol, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0, Lambda, Local_Delta_Time,
4489  Global_Delta_Time = 1E6, Global_Delta_UnstTimeND, ProjVel, ProjVel_i, ProjVel_j;
4490  unsigned long iEdge, iVertex, iPoint, jPoint;
4491  unsigned short iDim, iMarker;
4492 
4493  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
4494  bool grid_movement = config->GetGrid_Movement();
4495  bool time_steping = config->GetUnsteady_Simulation() == TIME_STEPPING;
4496  bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) ||
4497  (config->GetUnsteady_Simulation() == DT_STEPPING_2ND));
4498 
4499  Min_Delta_Time = 1.E6; Max_Delta_Time = 0.0;
4500 
4501  /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed ---*/
4502 
4503  for (iPoint = 0; iPoint < nPointDomain; iPoint++)
4504  node[iPoint]->SetMax_Lambda_Inv(0.0);
4505 
4506  /*--- Loop interior edges ---*/
4507  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
4508 
4509  /*--- Point identification, Normal vector and area ---*/
4510 
4511  iPoint = geometry->edge[iEdge]->GetNode(0);
4512  jPoint = geometry->edge[iEdge]->GetNode(1);
4513 
4514  Normal = geometry->edge[iEdge]->GetNormal();
4515  Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
4516 
4517  /*--- Mean Values ---*/
4518 
4519  Mean_ProjVel = 0.5 * (node[iPoint]->GetProjVel(Normal) + node[jPoint]->GetProjVel(Normal));
4520  Mean_SoundSpeed = 0.5 * (node[iPoint]->GetSoundSpeed() + node[jPoint]->GetSoundSpeed()) * Area;
4521 
4522  /*--- Adjustment for grid movement ---*/
4523 
4524  if (grid_movement) {
4525  su2double *GridVel_i = geometry->node[iPoint]->GetGridVel();
4526  su2double *GridVel_j = geometry->node[jPoint]->GetGridVel();
4527  ProjVel_i = 0.0; ProjVel_j = 0.0;
4528  for (iDim = 0; iDim < nDim; iDim++) {
4529  ProjVel_i += GridVel_i[iDim]*Normal[iDim];
4530  ProjVel_j += GridVel_j[iDim]*Normal[iDim];
4531  }
4532  Mean_ProjVel -= 0.5 * (ProjVel_i + ProjVel_j);
4533  }
4534 
4535  /*--- Inviscid contribution ---*/
4536 
4537  Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
4538  if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Inv(Lambda);
4539  if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddMax_Lambda_Inv(Lambda);
4540 
4541  }
4542 
4543  /*--- Loop boundary edges ---*/
4544 
4545  for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
4546  if (config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY)
4547  for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
4548 
4549  /*--- Point identification, Normal vector and area ---*/
4550 
4551  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
4552  Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
4553  Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
4554 
4555  /*--- Mean Values ---*/
4556 
4557  Mean_ProjVel = node[iPoint]->GetProjVel(Normal);
4558  Mean_SoundSpeed = node[iPoint]->GetSoundSpeed() * Area;
4559 
4560  /*--- Adjustment for grid movement ---*/
4561 
4562  if (grid_movement) {
4563  su2double *GridVel = geometry->node[iPoint]->GetGridVel();
4564  ProjVel = 0.0;
4565  for (iDim = 0; iDim < nDim; iDim++)
4566  ProjVel += GridVel[iDim]*Normal[iDim];
4567  Mean_ProjVel -= ProjVel;
4568  }
4569 
4570  /*--- Inviscid contribution ---*/
4571  Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
4572  if (geometry->node[iPoint]->GetDomain()) {
4573  node[iPoint]->AddMax_Lambda_Inv(Lambda);
4574  }
4575 
4576  }
4577  }
4578 
4579  /*--- Each element uses their own speed, steady state simulation ---*/
4580 
4581  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
4582 
4583  Vol = geometry->node[iPoint]->GetVolume();
4584 
4585  if (Vol != 0.0) {
4586  Local_Delta_Time = config->GetCFL(iMesh)*Vol / node[iPoint]->GetMax_Lambda_Inv();
4587  Global_Delta_Time = min(Global_Delta_Time, Local_Delta_Time);
4588  Min_Delta_Time = min(Min_Delta_Time, Local_Delta_Time);
4589  Max_Delta_Time = max(Max_Delta_Time, Local_Delta_Time);
4590  if (Local_Delta_Time > config->GetMax_DeltaTime())
4591  Local_Delta_Time = config->GetMax_DeltaTime();
4592  node[iPoint]->SetDelta_Time(Local_Delta_Time);
4593  }
4594  else {
4595  node[iPoint]->SetDelta_Time(0.0);
4596  }
4597 
4598  }
4599 
4600 
4601  /*--- Compute the max and the min dt (in parallel) ---*/
4602  if (config->GetConsole_Output_Verb() == VERB_HIGH) {
4603 #ifdef HAVE_MPI
4604  su2double rbuf_time, sbuf_time;
4605  sbuf_time = Min_Delta_Time;
4606  SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD);
4608  Min_Delta_Time = rbuf_time;
4609 
4610  sbuf_time = Max_Delta_Time;
4611  SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MAX, MASTER_NODE, MPI_COMM_WORLD);
4613  Max_Delta_Time = rbuf_time;
4614 #endif
4615  }
4616 
4617  /*--- For exact time solution use the minimum delta time of the whole mesh ---*/
4618 
4619  if (time_steping) {
4620 #ifdef HAVE_MPI
4621  su2double rbuf_time, sbuf_time;
4622  sbuf_time = Global_Delta_Time;
4623  SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD);
4625  Global_Delta_Time = rbuf_time;
4626 #endif
4627  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
4628 
4629  /*--- Sets the regular CFL equal to the unsteady CFL ---*/
4630  config->SetCFL(iMesh,config->GetUnst_CFL());
4631 
4632  /*--- If the unsteady CFL is set to zero, it uses the defined unsteady time step, otherwise
4633  it computes the time step based on the unsteady CFL ---*/
4634  if (config->GetCFL(iMesh) == 0.0) {
4635  node[iPoint]->SetDelta_Time(config->GetDelta_UnstTime());
4636  } else {
4637  node[iPoint]->SetDelta_Time(Global_Delta_Time);
4638  }
4639  }
4640  }
4641 
4642  /*--- Recompute the unsteady time step for the dual time strategy
4643  if the unsteady CFL is diferent from 0 ---*/
4644 
4645  if ((dual_time) && (Iteration == 0) && (config->GetUnst_CFL() != 0.0) && (iMesh == MESH_0)) {
4646  Global_Delta_UnstTimeND = config->GetUnst_CFL()*Global_Delta_Time/config->GetCFL(iMesh);
4647 
4648 #ifdef HAVE_MPI
4649  su2double rbuf_time, sbuf_time;
4650  sbuf_time = Global_Delta_UnstTimeND;
4651  SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD);
4653  Global_Delta_UnstTimeND = rbuf_time;
4654 #endif
4655  config->SetDelta_UnstTimeND(Global_Delta_UnstTimeND);
4656  }
4657 
4658  /*--- The pseudo local time (explicit integration) cannot be greater than the physical time ---*/
4659 
4660  if (dual_time)
4661  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
4662  if (!implicit) {
4663  Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), node[iPoint]->GetDelta_Time());
4664  node[iPoint]->SetDelta_Time(Local_Delta_Time);
4665  }
4666  }
4667 
4668 }
4669 
4670 void CEulerSolver::Centered_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics,
4671  CConfig *config, unsigned short iMesh, unsigned short iRKStep) {
4672 
4673  unsigned long iEdge, iPoint, jPoint;
4674 
4675  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
4676  bool jst_scheme = ((config->GetKind_Centered_Flow() == JST) && (iMesh == MESH_0));
4677  bool grid_movement = config->GetGrid_Movement();
4678 
4679  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
4680 
4681  /*--- Points in edge, set normal vectors, and number of neighbors ---*/
4682 
4683  iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1);
4684  numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
4685  numerics->SetNeighbor(geometry->node[iPoint]->GetnNeighbor(), geometry->node[jPoint]->GetnNeighbor());
4686 
4687  /*--- Set primitive variables w/o reconstruction ---*/
4688 
4689  numerics->SetPrimitive(node[iPoint]->GetPrimitive(), node[jPoint]->GetPrimitive());
4690 
4691  /*--- Set the largest convective eigenvalue ---*/
4692 
4693  numerics->SetLambda(node[iPoint]->GetLambda(), node[jPoint]->GetLambda());
4694 
4695  /*--- Set undivided laplacian an pressure based sensor ---*/
4696 
4697  if (jst_scheme) {
4698  numerics->SetUndivided_Laplacian(node[iPoint]->GetUndivided_Laplacian(), node[jPoint]->GetUndivided_Laplacian());
4699  numerics->SetSensor(node[iPoint]->GetSensor(), node[jPoint]->GetSensor());
4700  }
4701 
4702  /*--- Grid movement ---*/
4703 
4704  if (grid_movement) {
4705  numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[jPoint]->GetGridVel());
4706  }
4707 
4708  /*--- Compute residuals, and Jacobians ---*/
4709 
4710  numerics->ComputeResidual(Res_Conv, Jacobian_i, Jacobian_j, config);
4711 
4712  /*--- Update convective and artificial dissipation residuals ---*/
4713 
4714  LinSysRes.AddBlock(iPoint, Res_Conv);
4715  LinSysRes.SubtractBlock(jPoint, Res_Conv);
4716 
4717  /*--- Set implicit computation ---*/
4718  if (implicit) {
4719  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
4720  Jacobian.AddBlock(iPoint, jPoint, Jacobian_j);
4721  Jacobian.SubtractBlock(jPoint, iPoint, Jacobian_i);
4722  Jacobian.SubtractBlock(jPoint, jPoint, Jacobian_j);
4723  }
4724  }
4725 
4726 }
4727 
4728 void CEulerSolver::Upwind_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics,
4729  CConfig *config, unsigned short iMesh) {
4730 
4731  su2double **Gradient_i, **Gradient_j, Project_Grad_i, Project_Grad_j, RoeVelocity[3] = {0.0,0.0,0.0}, R, sq_vel, RoeEnthalpy,
4732  *V_i, *V_j, *S_i, *S_j, *Limiter_i = NULL, *Limiter_j = NULL, sqvel, Non_Physical = 1.0, Sensor_i, Sensor_j, Dissipation_i, Dissipation_j, *Coord_i, *Coord_j;
4733 
4734  su2double z, velocity2_i, velocity2_j, mach_i, mach_j, vel_i_corr[3], vel_j_corr[3];
4735 
4736  unsigned long iEdge, iPoint, jPoint, counter_local = 0, counter_global = 0;
4737  unsigned short iDim, iVar;
4738 
4739  bool neg_density_i = false, neg_density_j = false, neg_pressure_i = false, neg_pressure_j = false, neg_sound_speed = false;
4740 
4741  unsigned long ExtIter = config->GetExtIter();
4742  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
4743  bool muscl = (config->GetMUSCL_Flow() && (iMesh == MESH_0));
4744  bool disc_adjoint = config->GetDiscrete_Adjoint();
4745  bool limiter = ((config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (ExtIter <= config->GetLimiterIter()) && !(disc_adjoint && config->GetFrozen_Limiter_Disc()));
4746  bool grid_movement = config->GetGrid_Movement();
4747  bool roe_turkel = (config->GetKind_Upwind_Flow() == TURKEL);
4748  bool ideal_gas = (config->GetKind_FluidModel() == STANDARD_AIR || config->GetKind_FluidModel() == IDEAL_GAS );
4749  bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE;
4750  bool low_mach_corr = config->Low_Mach_Correction();
4751  unsigned short kind_dissipation = config->GetKind_RoeLowDiss();
4752 
4753  /*--- Loop over all the edges ---*/
4754 
4755  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
4756 
4757  /*--- Points in edge and normal vectors ---*/
4758 
4759  iPoint = geometry->edge[iEdge]->GetNode(0); jPoint = geometry->edge[iEdge]->GetNode(1);
4760  numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
4761 
4762  /*--- Roe Turkel preconditioning ---*/
4763 
4764  if (roe_turkel) {
4765  sqvel = 0.0;
4766  for (iDim = 0; iDim < nDim; iDim ++)
4767  sqvel += config->GetVelocity_FreeStream()[iDim]*config->GetVelocity_FreeStream()[iDim];
4768  numerics->SetVelocity2_Inf(sqvel);
4769  }
4770 
4771  /*--- Grid movement ---*/
4772 
4773  if (grid_movement)
4774  numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[jPoint]->GetGridVel());
4775 
4776  /*--- Get primitive variables ---*/
4777 
4778  V_i = node[iPoint]->GetPrimitive(); V_j = node[jPoint]->GetPrimitive();
4779  S_i = node[iPoint]->GetSecondary(); S_j = node[jPoint]->GetSecondary();
4780 
4781  /*--- High order reconstruction using MUSCL strategy ---*/
4782 
4783  if (muscl) {
4784 
4785  for (iDim = 0; iDim < nDim; iDim++) {
4786  Vector_i[iDim] = 0.5*(geometry->node[jPoint]->GetCoord(iDim) - geometry->node[iPoint]->GetCoord(iDim));
4787  Vector_j[iDim] = 0.5*(geometry->node[iPoint]->GetCoord(iDim) - geometry->node[jPoint]->GetCoord(iDim));
4788  }
4789 
4790  Gradient_i = node[iPoint]->GetGradient_Primitive();
4791  Gradient_j = node[jPoint]->GetGradient_Primitive();
4792  if (limiter) {
4793  Limiter_i = node[iPoint]->GetLimiter_Primitive();
4794  Limiter_j = node[jPoint]->GetLimiter_Primitive();
4795  }
4796 
4797  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
4798  Project_Grad_i = 0.0; Project_Grad_j = 0.0;
4799  Non_Physical = node[iPoint]->GetNon_Physical()*node[jPoint]->GetNon_Physical();
4800  for (iDim = 0; iDim < nDim; iDim++) {
4801  Project_Grad_i += Vector_i[iDim]*Gradient_i[iVar][iDim]*Non_Physical;
4802  Project_Grad_j += Vector_j[iDim]*Gradient_j[iVar][iDim]*Non_Physical;
4803  }
4804  if (limiter) {
4805  if (van_albada){
4806  Limiter_i[iVar] = (V_j[iVar]-V_i[iVar])*(2.0*Project_Grad_i + V_j[iVar]-V_i[iVar])/(4*Project_Grad_i*Project_Grad_i+(V_j[iVar]-V_i[iVar])*(V_j[iVar]-V_i[iVar])+EPS);
4807  Limiter_j[iVar] = (V_j[iVar]-V_i[iVar])*(-2.0*Project_Grad_j + V_j[iVar]-V_i[iVar])/(4*Project_Grad_j*Project_Grad_j+(V_j[iVar]-V_i[iVar])*(V_j[iVar]-V_i[iVar])+EPS);
4808  }
4809  Primitive_i[iVar] = V_i[iVar] + Limiter_i[iVar]*Project_Grad_i;
4810  Primitive_j[iVar] = V_j[iVar] + Limiter_j[iVar]*Project_Grad_j;
4811  }
4812  else {
4813  Primitive_i[iVar] = V_i[iVar] + Project_Grad_i;
4814  Primitive_j[iVar] = V_j[iVar] + Project_Grad_j;
4815  }
4816  }
4817 
4818  /*--- Recompute the extrapolated quantities in a
4819  thermodynamic consistent way ---*/
4820 
4821  if (!ideal_gas || low_mach_corr) { ComputeConsExtrapolation(config); }
4822 
4823  /*--- Low-Mach number correction ---*/
4824 
4825  if (low_mach_corr) {
4826 
4827  velocity2_i = 0.0;
4828  velocity2_j = 0.0;
4829 
4830  for (iDim = 0; iDim < nDim; iDim++) {
4831  velocity2_i += Primitive_i[iDim+1]*Primitive_i[iDim+1];
4832  velocity2_j += Primitive_j[iDim+1]*Primitive_j[iDim+1];
4833  }
4834  mach_i = sqrt(velocity2_i)/Primitive_i[nDim+4];
4835  mach_j = sqrt(velocity2_j)/Primitive_j[nDim+4];
4836 
4837  z = min(max(mach_i,mach_j),1.0);
4838  velocity2_i = 0.0;
4839  velocity2_j = 0.0;
4840  for (iDim = 0; iDim < nDim; iDim++) {
4841  vel_i_corr[iDim] = ( Primitive_i[iDim+1] + Primitive_j[iDim+1] )/2.0 \
4842  + z * ( Primitive_i[iDim+1] - Primitive_j[iDim+1] )/2.0;
4843  vel_j_corr[iDim] = ( Primitive_i[iDim+1] + Primitive_j[iDim+1] )/2.0 \
4844  + z * ( Primitive_j[iDim+1] - Primitive_i[iDim+1] )/2.0;
4845 
4846  velocity2_j += vel_j_corr[iDim]*vel_j_corr[iDim];
4847  velocity2_i += vel_i_corr[iDim]*vel_i_corr[iDim];
4848 
4849  Primitive_i[iDim+1] = vel_i_corr[iDim];
4850  Primitive_j[iDim+1] = vel_j_corr[iDim];
4851  }
4852 
4854  Primitive_i[nDim+3]= FluidModel->GetStaticEnergy() + Primitive_i[nDim+1]/Primitive_i[nDim+2] + 0.5*velocity2_i;
4855 
4857  Primitive_j[nDim+3]= FluidModel->GetStaticEnergy() + Primitive_j[nDim+1]/Primitive_j[nDim+2] + 0.5*velocity2_j;
4858 
4859  }
4860 
4861  /*--- Check for non-physical solutions after reconstruction. If found,
4862  use the cell-average value of the solution. This results in a locally
4863  first-order approximation, but this is typically only active
4864  during the start-up of a calculation. If non-physical, use the
4865  cell-averaged state. ---*/
4866 
4867  neg_pressure_i = (Primitive_i[nDim+1] < 0.0); neg_pressure_j = (Primitive_j[nDim+1] < 0.0);
4868  neg_density_i = (Primitive_i[nDim+2] < 0.0); neg_density_j = (Primitive_j[nDim+2] < 0.0);
4869 
4870  R = sqrt(fabs(Primitive_j[nDim+2]/Primitive_i[nDim+2]));
4871  sq_vel = 0.0;
4872  for (iDim = 0; iDim < nDim; iDim++) {
4873  RoeVelocity[iDim] = (R*Primitive_j[iDim+1]+Primitive_i[iDim+1])/(R+1);
4874  sq_vel += RoeVelocity[iDim]*RoeVelocity[iDim];
4875  }
4876  RoeEnthalpy = (R*Primitive_j[nDim+3]+Primitive_i[nDim+3])/(R+1);
4877  neg_sound_speed = ((Gamma-1)*(RoeEnthalpy-0.5*sq_vel) < 0.0);
4878 
4879  if (neg_sound_speed) {
4880  for (iVar = 0; iVar < nPrimVar; iVar++) {
4881  Primitive_i[iVar] = V_i[iVar];
4882  Primitive_j[iVar] = V_j[iVar]; }
4883  Secondary_i[0] = S_i[0]; Secondary_i[1] = S_i[1];
4884  Secondary_j[0] = S_i[0]; Secondary_j[1] = S_i[1];
4885  counter_local++;
4886  }
4887 
4888  if (neg_density_i || neg_pressure_i) {
4889  for (iVar = 0; iVar < nPrimVar; iVar++) Primitive_i[iVar] = V_i[iVar];
4890  Secondary_i[0] = S_i[0]; Secondary_i[1] = S_i[1];
4891  counter_local++;
4892  }
4893 
4894  if (neg_density_j || neg_pressure_j) {
4895  for (iVar = 0; iVar < nPrimVar; iVar++) Primitive_j[iVar] = V_j[iVar];
4896  Secondary_j[0] = S_j[0]; Secondary_j[1] = S_j[1];
4897  counter_local++;
4898  }
4899 
4900  numerics->SetPrimitive(Primitive_i, Primitive_j);
4901  numerics->SetSecondary(Secondary_i, Secondary_j);
4902 
4903  }
4904  else {
4905 
4906  /*--- Set conservative variables without reconstruction ---*/
4907 
4908  numerics->SetPrimitive(V_i, V_j);
4909  numerics->SetSecondary(S_i, S_j);
4910 
4911  }
4912 
4913  /*--- Roe Low Dissipation Scheme ---*/
4914 
4915  if (kind_dissipation != NO_ROELOWDISS){
4916 
4917  Dissipation_i = node[iPoint]->GetRoe_Dissipation();
4918  Dissipation_j = node[jPoint]->GetRoe_Dissipation();
4919  numerics->SetDissipation(Dissipation_i, Dissipation_j);
4920 
4921  if (kind_dissipation == FD_DUCROS || kind_dissipation == NTS_DUCROS){
4922  Sensor_i = node[iPoint]->GetSensor();
4923  Sensor_j = node[jPoint]->GetSensor();
4924  numerics->SetSensor(Sensor_i, Sensor_j);
4925  }
4926  if (kind_dissipation == NTS || kind_dissipation == NTS_DUCROS){
4927  Coord_i = geometry->node[iPoint]->GetCoord();
4928  Coord_j = geometry->node[jPoint]->GetCoord();
4929  numerics->SetCoord(Coord_i, Coord_j);
4930  }
4931  }
4932 
4933  /*--- Compute the residual ---*/
4934 
4935  numerics->ComputeResidual(Res_Conv, Jacobian_i, Jacobian_j, config);
4936 
4937  /*--- Update residual value ---*/
4938 
4939  LinSysRes.AddBlock(iPoint, Res_Conv);
4940  LinSysRes.SubtractBlock(jPoint, Res_Conv);
4941 
4942  /*--- Set implicit Jacobians ---*/
4943 
4944  if (implicit) {
4945  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
4946  Jacobian.AddBlock(iPoint, jPoint, Jacobian_j);
4947  Jacobian.SubtractBlock(jPoint, iPoint, Jacobian_i);
4948  Jacobian.SubtractBlock(jPoint, jPoint, Jacobian_j);
4949  }
4950 
4951  /*--- Roe Turkel preconditioning, set the value of beta ---*/
4952 
4953  if (roe_turkel) {
4954  node[iPoint]->SetPreconditioner_Beta(numerics->GetPrecond_Beta());
4955  node[jPoint]->SetPreconditioner_Beta(numerics->GetPrecond_Beta());
4956  }
4957 
4958  /*--- Set the final value of the Roe dissipation coefficient ---*/
4959 
4960  if (kind_dissipation != NO_ROELOWDISS){
4961  node[iPoint]->SetRoe_Dissipation(numerics->GetDissipation());
4962  node[jPoint]->SetRoe_Dissipation(numerics->GetDissipation());
4963  }
4964 
4965  }
4966 
4967  /*--- Warning message about non-physical reconstructions ---*/
4968 
4969  if (config->GetConsole_Output_Verb() == VERB_HIGH) {
4970 #ifdef HAVE_MPI
4971  SU2_MPI::Reduce(&counter_local, &counter_global, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD);
4972 #else
4973  counter_global = counter_local;
4974 #endif
4975  if (iMesh == MESH_0) config->SetNonphysical_Reconstr(counter_global);
4976  }
4977 }
4978 
4980 
4981  unsigned short iDim;
4982 
4983  su2double density_i = Primitive_i[nDim+2];
4984  su2double pressure_i = Primitive_i[nDim+1];
4985  su2double velocity2_i = 0.0;
4986  for (iDim = 0; iDim < nDim; iDim++) {
4987  velocity2_i += Primitive_i[iDim+1]*Primitive_i[iDim+1];
4988  }
4989 
4990  FluidModel->SetTDState_Prho(pressure_i, density_i);
4991 
4993  Primitive_i[nDim+3]= FluidModel->GetStaticEnergy() + Primitive_i[nDim+1]/Primitive_i[nDim+2] + 0.5*velocity2_i;
4997 
4998 
4999  su2double density_j = Primitive_j[nDim+2];
5000  su2double pressure_j = Primitive_j[nDim+1];
5001  su2double velocity2_j = 0.0;
5002  for (iDim = 0; iDim < nDim; iDim++) {
5003  velocity2_j += Primitive_j[iDim+1]*Primitive_j[iDim+1];
5004  }
5005 
5006  FluidModel->SetTDState_Prho(pressure_j, density_j);
5007 
5009  Primitive_j[nDim+3]= FluidModel->GetStaticEnergy() + Primitive_j[nDim+1]/Primitive_j[nDim+2] + 0.5*velocity2_j;
5013 
5014 }
5015 
5016 void CEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CNumerics *second_numerics,
5017  CConfig *config, unsigned short iMesh) {
5018 
5019  unsigned short iVar;
5020  unsigned long iPoint;
5021  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
5022  bool rotating_frame = config->GetRotating_Frame();
5023  bool axisymmetric = config->GetAxisymmetric();
5024  bool gravity = (config->GetGravityForce() == YES);
5025  bool harmonic_balance = (config->GetUnsteady_Simulation() == HARMONIC_BALANCE);
5026  bool windgust = config->GetWind_Gust();
5027  bool body_force = config->GetBody_Force();
5028 
5029  /*--- Initialize the source residual to zero ---*/
5030 
5031  for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0;
5032 
5033  if (body_force) {
5034 
5035  /*--- Loop over all points ---*/
5036  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
5037 
5038  /*--- Load the conservative variables ---*/
5039  numerics->SetConservative(node[iPoint]->GetSolution(),
5040  node[iPoint]->GetSolution());
5041 
5042  /*--- Load the volume of the dual mesh cell ---*/
5043  numerics->SetVolume(geometry->node[iPoint]->GetVolume());
5044 
5045  /*--- Compute the rotating frame source residual ---*/
5046  numerics->ComputeResidual(Residual, config);
5047 
5048  /*--- Add the source residual to the total ---*/
5049  LinSysRes.AddBlock(iPoint, Residual);
5050 
5051  }
5052  }
5053 
5054  if (rotating_frame) {
5055 
5056  /*--- Loop over all points ---*/
5057  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
5058 
5059  /*--- Load the conservative variables ---*/
5060  numerics->SetConservative(node[iPoint]->GetSolution(),
5061  node[iPoint]->GetSolution());
5062 
5063  /*--- Load the volume of the dual mesh cell ---*/
5064  numerics->SetVolume(geometry->node[iPoint]->GetVolume());
5065 
5066  /*--- Compute the rotating frame source residual ---*/
5067  numerics->ComputeResidual(Residual, Jacobian_i, config);
5068 
5069  /*--- Add the source residual to the total ---*/
5070  LinSysRes.AddBlock(iPoint, Residual);
5071 
5072  /*--- Add the implicit Jacobian contribution ---*/
5073  if (implicit) Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
5074 
5075  }
5076  }
5077 
5078  if (axisymmetric) {
5079 
5080  /*--- Zero out Jacobian structure ---*/
5081  if (implicit) {
5082  for (iVar = 0; iVar < nVar; iVar ++)
5083  for (unsigned short jVar = 0; jVar < nVar; jVar ++)
5084  Jacobian_i[iVar][jVar] = 0.0;
5085  }
5086 
5087  /*--- loop over points ---*/
5088  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
5089 
5090  /*--- Set solution ---*/
5091  numerics->SetConservative(node[iPoint]->GetSolution(), node[iPoint]->GetSolution());
5092 
5093  /*--- Set control volume ---*/
5094  numerics->SetVolume(geometry->node[iPoint]->GetVolume());
5095 
5096  /*--- Set y coordinate ---*/
5097  numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[iPoint]->GetCoord());
5098 
5099  /*--- Compute Source term Residual ---*/
5100  numerics->ComputeResidual(Residual, Jacobian_i, config);
5101 
5102  /*--- Add Residual ---*/
5103  LinSysRes.AddBlock(iPoint, Residual);
5104 
5105  /*--- Implicit part ---*/
5106  if (implicit)
5107  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
5108  }
5109  }
5110 
5111  if (gravity) {
5112 
5113  /*--- loop over points ---*/
5114  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
5115 
5116  /*--- Set solution ---*/
5117  numerics->SetConservative(node[iPoint]->GetSolution(), node[iPoint]->GetSolution());
5118 
5119  /*--- Set control volume ---*/
5120  numerics->SetVolume(geometry->node[iPoint]->GetVolume());
5121 
5122  /*--- Compute Source term Residual ---*/
5123  numerics->ComputeResidual(Residual, config);
5124 
5125  /*--- Add Residual ---*/
5126  LinSysRes.AddBlock(iPoint, Residual);
5127 
5128  }
5129 
5130  }
5131 
5132  if (harmonic_balance) {
5133 
5134  su2double Volume, Source;
5135 
5136  /*--- loop over points ---*/
5137  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
5138 
5139  /*--- Get control volume ---*/
5140  Volume = geometry->node[iPoint]->GetVolume();
5141 
5142  /*--- Get stored time spectral source term ---*/
5143  for (iVar = 0; iVar < nVar; iVar++) {
5144  Source = node[iPoint]->GetHarmonicBalance_Source(iVar);
5145  Residual[iVar] = Source*Volume;
5146  }
5147 
5148  /*--- Add Residual ---*/
5149  LinSysRes.AddBlock(iPoint, Residual);
5150 
5151  }
5152  }
5153 
5154  if (windgust) {
5155 
5156  /*--- Loop over all points ---*/
5157  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
5158 
5159  /*--- Load the wind gust ---*/
5160  numerics->SetWindGust(node[iPoint]->GetWindGust(), node[iPoint]->GetWindGust());
5161 
5162  /*--- Load the wind gust derivatives ---*/
5163  numerics->SetWindGustDer(node[iPoint]->GetWindGustDer(), node[iPoint]->GetWindGustDer());
5164 
5165  /*--- Load the primitive variables ---*/
5166  numerics->SetPrimitive(node[iPoint]->GetPrimitive(), node[iPoint]->GetPrimitive());
5167 
5168  /*--- Load the volume of the dual mesh cell ---*/
5169  numerics->SetVolume(geometry->node[iPoint]->GetVolume());
5170 
5171  /*--- Compute the rotating frame source residual ---*/
5172  numerics->ComputeResidual(Residual, Jacobian_i, config);
5173 
5174  /*--- Add the source residual to the total ---*/
5175  LinSysRes.AddBlock(iPoint, Residual);
5176 
5177  /*--- Add the implicit Jacobian contribution ---*/
5178  if (implicit) Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
5179 
5180  }
5181  }
5182 
5183 }
5184 
5185 void CEulerSolver::Source_Template(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics,
5186  CConfig *config, unsigned short iMesh) {
5187 
5188  /* This method should be used to call any new source terms for a particular problem*/
5189  /* This method calls the new child class in CNumerics, where the new source term should be implemented. */
5190 
5191  /* Next we describe how to get access to some important quanties for this method */
5192  /* Access to all points in the current geometric mesh by saying: nPointDomain */
5193  /* Get the vector of conservative variables at some point iPoint = node[iPoint]->GetSolution() */
5194  /* Get the volume (or area in 2D) associated with iPoint = node[iPoint]->GetVolume() */
5195  /* Get the vector of geometric coordinates of point iPoint = node[iPoint]->GetCoord() */
5196 
5197 }
5198 
5200 
5201  su2double *Normal, Area, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0, Lambda,
5202  ProjVel, ProjVel_i, ProjVel_j, *GridVel, *GridVel_i, *GridVel_j;
5203  unsigned long iEdge, iVertex, iPoint, jPoint;
5204  unsigned short iDim, iMarker;
5205 
5206  bool grid_movement = config->GetGrid_Movement();
5207 
5208  /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed ---*/
5209 
5210  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
5211  node[iPoint]->SetLambda(0.0);
5212  }
5213 
5214  /*--- Loop interior edges ---*/
5215 
5216  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
5217 
5218  /*--- Point identification, Normal vector and area ---*/
5219 
5220  iPoint = geometry->edge[iEdge]->GetNode(0);
5221  jPoint = geometry->edge[iEdge]->GetNode(1);
5222 
5223  Normal = geometry->edge[iEdge]->GetNormal();
5224  Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
5225 
5226  /*--- Mean Values ---*/
5227 
5228  Mean_ProjVel = 0.5 * (node[iPoint]->GetProjVel(Normal) + node[jPoint]->GetProjVel(Normal));
5229  Mean_SoundSpeed = 0.5 * (node[iPoint]->GetSoundSpeed() + node[jPoint]->GetSoundSpeed()) * Area;
5230 
5231  /*--- Adjustment for grid movement ---*/
5232 
5233  if (grid_movement) {
5234  GridVel_i = geometry->node[iPoint]->GetGridVel();
5235  GridVel_j = geometry->node[jPoint]->GetGridVel();
5236  ProjVel_i = 0.0; ProjVel_j =0.0;
5237  for (iDim = 0; iDim < nDim; iDim++) {
5238  ProjVel_i += GridVel_i[iDim]*Normal[iDim];
5239  ProjVel_j += GridVel_j[iDim]*Normal[iDim];
5240  }
5241  Mean_ProjVel -= 0.5 * (ProjVel_i + ProjVel_j);
5242  }
5243 
5244  /*--- Inviscid contribution ---*/
5245 
5246  Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
5247  if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddLambda(Lambda);
5248  if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddLambda(Lambda);
5249 
5250  }
5251 
5252  /*--- Loop boundary edges ---*/
5253 
5254  for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
5255  if (config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY)
5256  for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
5257 
5258  /*--- Point identification, Normal vector and area ---*/
5259 
5260  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
5261  Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
5262  Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
5263 
5264  /*--- Mean Values ---*/
5265 
5266  Mean_ProjVel = node[iPoint]->GetProjVel(Normal);
5267  Mean_SoundSpeed = node[iPoint]->GetSoundSpeed() * Area;
5268 
5269  /*--- Adjustment for grid movement ---*/
5270 
5271  if (grid_movement) {
5272  GridVel = geometry->node[iPoint]->GetGridVel();
5273  ProjVel = 0.0;
5274  for (iDim = 0; iDim < nDim; iDim++)
5275  ProjVel += GridVel[iDim]*Normal[iDim];
5276  Mean_ProjVel -= ProjVel;
5277  }
5278 
5279  /*--- Inviscid contribution ---*/
5280 
5281  Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
5282  if (geometry->node[iPoint]->GetDomain()) {
5283  node[iPoint]->AddLambda(Lambda);
5284  }
5285 
5286  }
5287  }
5288 
5289  /*--- MPI parallelization ---*/
5290 
5291  Set_MPI_MaxEigenvalue(geometry, config);
5292 
5293 }
5294 
5296 
5297  unsigned long iPoint, jPoint, iEdge;
5298  su2double Pressure_i = 0, Pressure_j = 0, *Diff;
5299  unsigned short iVar;
5300  bool boundary_i, boundary_j;
5301 
5302  Diff = new su2double[nVar];
5303 
5304  for (iPoint = 0; iPoint < nPointDomain; iPoint++)
5305  node[iPoint]->SetUnd_LaplZero();
5306 
5307  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
5308 
5309  iPoint = geometry->edge[iEdge]->GetNode(0);
5310  jPoint = geometry->edge[iEdge]->GetNode(1);
5311 
5312  /*--- Solution differences ---*/
5313 
5314  for (iVar = 0; iVar < nVar; iVar++)
5315  Diff[iVar] = node[iPoint]->GetSolution(iVar) - node[jPoint]->GetSolution(iVar);
5316 
5317  /*--- Correction for compressible flows which use the enthalpy ---*/
5318 
5319  Pressure_i = node[iPoint]->GetPressure();
5320  Pressure_j = node[jPoint]->GetPressure();
5321  Diff[nVar-1] = (node[iPoint]->GetSolution(nVar-1) + Pressure_i) - (node[jPoint]->GetSolution(nVar-1) + Pressure_j);
5322 
5323  boundary_i = geometry->node[iPoint]->GetPhysicalBoundary();
5324  boundary_j = geometry->node[jPoint]->GetPhysicalBoundary();
5325 
5326  /*--- Both points inside the domain, or both in the boundary ---*/
5327 
5328  if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) {
5329  if (geometry->node[iPoint]->GetDomain()) node[iPoint]->SubtractUnd_Lapl(Diff);
5330  if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddUnd_Lapl(Diff);
5331  }
5332 
5333  /*--- iPoint inside the domain, jPoint on the boundary ---*/
5334 
5335  if (!boundary_i && boundary_j)
5336  if (geometry->node[iPoint]->GetDomain()) node[iPoint]->SubtractUnd_Lapl(Diff);
5337 
5338  /*--- jPoint inside the domain, iPoint on the boundary ---*/
5339 
5340  if (boundary_i && !boundary_j)
5341  if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddUnd_Lapl(Diff);
5342 
5343  }
5344 
5345  /*--- MPI parallelization ---*/
5346 
5347  Set_MPI_Undivided_Laplacian(geometry, config);
5348 
5349  delete [] Diff;
5350 
5351 }
5352 
5354 
5355  unsigned long iEdge, iPoint, jPoint;
5356  su2double Pressure_i = 0.0, Pressure_j = 0.0;
5357  bool boundary_i, boundary_j;
5358 
5359  /*--- Reset variables to store the undivided pressure ---*/
5360 
5361  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
5362  iPoint_UndLapl[iPoint] = 0.0;
5363  jPoint_UndLapl[iPoint] = 0.0;
5364  }
5365 
5366  /*--- Evaluate the pressure sensor ---*/
5367 
5368  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
5369 
5370  iPoint = geometry->edge[iEdge]->GetNode(0);
5371  jPoint = geometry->edge[iEdge]->GetNode(1);
5372 
5373  Pressure_i = node[iPoint]->GetPressure();
5374  Pressure_j = node[jPoint]->GetPressure();
5375 
5376  boundary_i = geometry->node[iPoint]->GetPhysicalBoundary();
5377  boundary_j = geometry->node[jPoint]->GetPhysicalBoundary();
5378 
5379  /*--- Both points inside the domain, or both on the boundary ---*/
5380 
5381  if ((!boundary_i && !boundary_j) || (boundary_i && boundary_j)) {
5382  if (geometry->node[iPoint]->GetDomain()) { iPoint_UndLapl[iPoint] += (Pressure_j - Pressure_i); jPoint_UndLapl[iPoint] += (Pressure_i + Pressure_j); }
5383  if (geometry->node[jPoint]->GetDomain()) { iPoint_UndLapl[jPoint] += (Pressure_i - Pressure_j); jPoint_UndLapl[jPoint] += (Pressure_i + Pressure_j); }
5384  }
5385 
5386  /*--- iPoint inside the domain, jPoint on the boundary ---*/
5387 
5388  if (!boundary_i && boundary_j)
5389  if (geometry->node[iPoint]->GetDomain()) { iPoint_UndLapl[iPoint] += (Pressure_j - Pressure_i); jPoint_UndLapl[iPoint] += (Pressure_i + Pressure_j); }
5390 
5391  /*--- jPoint inside the domain, iPoint on the boundary ---*/
5392 
5393  if (boundary_i && !boundary_j)
5394  if (geometry->node[jPoint]->GetDomain()) { iPoint_UndLapl[jPoint] += (Pressure_i - Pressure_j); jPoint_UndLapl[jPoint] += (Pressure_i + Pressure_j); }
5395 
5396  }
5397 
5398  /*--- Set pressure switch for each point ---*/
5399 
5400  for (iPoint = 0; iPoint < nPointDomain; iPoint++)
5401  node[iPoint]->SetSensor(fabs(iPoint_UndLapl[iPoint]) / jPoint_UndLapl[iPoint]);
5402 
5403  /*--- MPI parallelization ---*/
5404 
5405  Set_MPI_Sensor(geometry, config);
5406 
5407 }
5408 
5410 
5411  unsigned long iPoint, jPoint;
5412  unsigned short iNeigh, iDim;
5413 
5414  su2double *Vorticity;
5415 
5416  su2double uixi = 0.0, Ducros_i = 0.0, Ducros_j = 0.0, Omega = 0.0;
5417 
5418  for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++){
5419 
5420  /*---- Dilatation for iPoint ---*/
5421 
5422  uixi=0.0;
5423  for(iDim = 0; iDim < nDim; iDim++){
5424  uixi += node[iPoint]->GetGradient_Primitive(iDim+1, iDim);
5425  }
5426 
5427  /*--- Compute norm of vorticity ---*/
5428 
5429  Vorticity = node[iPoint]->GetVorticity();
5430  Omega = 0.0;
5431  for (iDim = 0; iDim < nDim; iDim++){
5432  Omega += Vorticity[iDim]*Vorticity[iDim];
5433  }
5434  Omega = sqrt(Omega);
5435 
5436  /*---- Ducros sensor for iPoint ---*/
5437 
5438  if (config->GetKind_RoeLowDiss() == FD_DUCROS){
5439  Ducros_i = -uixi / (fabs(uixi) + Omega + 1e-20);
5440  } else if (config->GetKind_RoeLowDiss() == NTS_DUCROS){
5441  Ducros_i = pow(uixi,2.0) /(pow(uixi,2.0)+ pow(Omega,2.0) + 1e-20);
5442  }
5443 
5444  node[iPoint]->SetSensor(Ducros_i);
5445 
5446  /*---- Ducros sensor for neighbor points of iPoint to avoid lower the dissipation in regions near the shock ---*/
5447 
5448  for (iNeigh = 0; iNeigh > geometry->node[iPoint]->GetnNeighbor(); iNeigh++){
5449 
5450  jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
5451 
5452  /*---- Dilatation for jPoint ---*/
5453 
5454  uixi=0.0;
5455  for(iDim = 0; iDim < nDim; iDim++){
5456  uixi += node[jPoint]->GetGradient_Primitive(iDim+1, iDim);
5457  }
5458 
5459  /*--- Compute norm of vorticity ---*/
5460 
5461  Vorticity = node[jPoint]->GetVorticity();
5462  Omega = 0.0;
5463  for (iDim = 0; iDim < nDim; iDim++){
5464  Omega += Vorticity[iDim]*Vorticity[iDim];
5465  }
5466  Omega = sqrt(Omega);
5467 
5468  if (config->GetKind_RoeLowDiss() == FD_DUCROS){
5469  Ducros_j = -uixi / (fabs(uixi) + Omega + 1e-20);
5470  } else if (config->GetKind_RoeLowDiss() == NTS_DUCROS){
5471  Ducros_j = pow(uixi,2.0) /(pow(uixi,2.0)+ pow(Omega,2.0) + 1e-20);
5472  }
5473  node[iPoint]->SetSensor(max(node[iPoint]->GetSensor(), Ducros_j));
5474 
5475  }
5476  }
5477 
5478  Set_MPI_Sensor(geometry, config);
5479 
5480 }
5481 
5483 
5484  unsigned long iVertex, iPoint;
5485  unsigned short iDim, iMarker, Boundary, Monitoring, iMarker_Monitoring;
5486  su2double Pressure = 0.0, *Normal = NULL, MomentDist[3] = {0.0,0.0,0.0}, *Coord,
5487  factor, NFPressOF, RefVel2, RefTemp, RefDensity, RefPressure, Mach2Vel, Mach_Motion,
5488  Force[3] = {0.0,0.0,0.0},
5489  Momentum = 0.0, Density, Area, MassFlow = 0.0, Velocity[3], Velocity2 = 0.0;
5490  string Marker_Tag, Monitoring_Tag;
5491  su2double MomentX_Force[3] = {0.0,0.0,0.0}, MomentY_Force[3] = {0.0,0.0,0.0}, MomentZ_Force[3] = {0.0,0.0,0.0};
5492  su2double AxiFactor;
5493  bool transp = (config->GetnMarker_Transpiration() > 0);
5494 
5495 #ifdef HAVE_MPI
5496  su2double MyAllBound_CD_Inv, MyAllBound_CL_Inv, MyAllBound_CSF_Inv, MyAllBound_CMx_Inv, MyAllBound_CMy_Inv, MyAllBound_CMz_Inv, MyAllBound_CoPx_Inv, MyAllBound_CoPy_Inv, MyAllBound_CoPz_Inv, MyAllBound_CFx_Inv, MyAllBound_CFy_Inv, MyAllBound_CFz_Inv, MyAllBound_CT_Inv, MyAllBound_CQ_Inv, MyAllBound_CNearFieldOF_Inv, *MySurface_CL_Inv = NULL, *MySurface_CD_Inv = NULL, *MySurface_CSF_Inv = NULL, *MySurface_CEff_Inv = NULL, *MySurface_CFx_Inv = NULL, *MySurface_CFy_Inv = NULL, *MySurface_CFz_Inv = NULL, *MySurface_CMx_Inv = NULL, *MySurface_CMy_Inv = NULL, *MySurface_CMz_Inv = NULL;
5497  su2double MyAllBound_Cmu, *MySurface_Cmu = NULL;
5498 #endif
5499 
5500  su2double Alpha = config->GetAoA()*PI_NUMBER/180.0;
5501  su2double Beta = config->GetAoS()*PI_NUMBER/180.0;
5502  su2double RefArea = config->GetRefArea();
5503  su2double RefLength = config->GetRefLength();
5504  su2double Gas_Constant = config->GetGas_ConstantND();
5505  su2double *Origin = NULL;
5506  if (config->GetnMarker_Monitoring() != 0){
5507  Origin = config->GetRefOriginMoment(0);
5508  }
5509  bool grid_movement = config->GetGrid_Movement();
5510  bool axisymmetric = config->GetAxisymmetric();
5511 
5512  /*--- Evaluate reference values for non-dimensionalization.
5513  For dynamic meshes, use the motion Mach number as a reference value
5514  for computing the force coefficients. Otherwise, use the freestream
5515  values, which is the standard convention. ---*/
5516 
5517  RefTemp = Temperature_Inf;
5518  RefDensity = Density_Inf;
5519  RefPressure = Pressure_Inf;
5520  if (grid_movement) {
5521  Mach2Vel = sqrt(Gamma*Gas_Constant*RefTemp);
5522  Mach_Motion = config->GetMach_Motion();
5523  RefVel2 = (Mach_Motion*Mach2Vel)*(Mach_Motion*Mach2Vel);
5524  }
5525  else {
5526  RefVel2 = 0.0;
5527  for (iDim = 0; iDim < nDim; iDim++)
5528  RefVel2 += Velocity_Inf[iDim]*Velocity_Inf[iDim];
5529  }
5530 
5531  factor = 1.0 / (0.5*RefDensity*RefArea*RefVel2);
5532 
5533  /*-- Variables initialization ---*/
5534 
5535  Total_CD = 0.0; Total_CL = 0.0; Total_CSF = 0.0; Total_CEff = 0.0;
5536  Total_CMx = 0.0; Total_CMy = 0.0; Total_CMz = 0.0;
5537  Total_CoPx = 0.0; Total_CoPy = 0.0; Total_CoPz = 0.0;
5538  Total_CFx = 0.0; Total_CFy = 0.0; Total_CFz = 0.0;
5539  Total_CT = 0.0; Total_CQ = 0.0; Total_CMerit = 0.0;
5540  Total_CNearFieldOF = 0.0; Total_Heat = 0.0; Total_MaxHeat = 0.0;
5541  Total_Cmu = 0.0;
5542 
5543  AllBound_CD_Inv = 0.0; AllBound_CL_Inv = 0.0; AllBound_CSF_Inv = 0.0;
5549  AllBound_Cmu = 0.0;
5550 
5551  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
5552  Surface_CL_Inv[iMarker_Monitoring] = 0.0; Surface_CD_Inv[iMarker_Monitoring] = 0.0;
5553  Surface_CSF_Inv[iMarker_Monitoring] = 0.0; Surface_CEff_Inv[iMarker_Monitoring] = 0.0;
5554  Surface_CFx_Inv[iMarker_Monitoring] = 0.0; Surface_CFy_Inv[iMarker_Monitoring] = 0.0;
5555  Surface_CFz_Inv[iMarker_Monitoring] = 0.0; Surface_CMx_Inv[iMarker_Monitoring] = 0.0;
5556  Surface_CMy_Inv[iMarker_Monitoring] = 0.0; Surface_CMz_Inv[iMarker_Monitoring] = 0.0;
5557  Surface_CL[iMarker_Monitoring] = 0.0; Surface_CD[iMarker_Monitoring] = 0.0;
5558  Surface_CSF[iMarker_Monitoring] = 0.0; Surface_CEff[iMarker_Monitoring] = 0.0;
5559  Surface_CFx[iMarker_Monitoring] = 0.0; Surface_CFy[iMarker_Monitoring] = 0.0;
5560  Surface_CFz[iMarker_Monitoring] = 0.0; Surface_CMx[iMarker_Monitoring] = 0.0;
5561  Surface_CMy[iMarker_Monitoring] = 0.0; Surface_CMz[iMarker_Monitoring] = 0.0;
5562  Surface_Cmu[iMarker_Monitoring] = 0.0;
5563  }
5564 
5565  /*--- Loop over the Euler and Navier-Stokes markers ---*/
5566 
5567  for (iMarker = 0; iMarker < nMarker; iMarker++) {
5568 
5569  Boundary = config->GetMarker_All_KindBC(iMarker);
5570  Monitoring = config->GetMarker_All_Monitoring(iMarker);
5571 
5572  /*--- Obtain the origin for the moment computation for a particular marker ---*/
5573 
5574  if (Monitoring == YES) {
5575  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
5576  Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
5577  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
5578  if (Marker_Tag == Monitoring_Tag)
5579  Origin = config->GetRefOriginMoment(iMarker_Monitoring);
5580  }
5581  }
5582 
5583  if ((Boundary == EULER_WALL) || (Boundary == HEAT_FLUX) ||
5584  (Boundary == ISOTHERMAL) || (Boundary == NEARFIELD_BOUNDARY) ||
5585  (Boundary == INLET_FLOW) || (Boundary == OUTLET_FLOW) ||
5586  (Boundary == ACTDISK_INLET) || (Boundary == ACTDISK_OUTLET)||
5587  (Boundary == ENGINE_INFLOW) || (Boundary == ENGINE_EXHAUST)||
5588  (Boundary == TRANSPIRATION) ) {
5589 
5590  /*--- Forces initialization at each Marker ---*/
5591 
5592  CD_Inv[iMarker] = 0.0; CL_Inv[iMarker] = 0.0; CSF_Inv[iMarker] = 0.0;
5593  CMx_Inv[iMarker] = 0.0; CMy_Inv[iMarker] = 0.0; CMz_Inv[iMarker] = 0.0;
5594  CoPx_Inv[iMarker] = 0.0; CoPy_Inv[iMarker] = 0.0; CoPz_Inv[iMarker] = 0.0;
5595  CFx_Inv[iMarker] = 0.0; CFy_Inv[iMarker] = 0.0; CFz_Inv[iMarker] = 0.0;
5596  CT_Inv[iMarker] = 0.0; CQ_Inv[iMarker] = 0.0; CMerit_Inv[iMarker] = 0.0;
5597  CNearFieldOF_Inv[iMarker] = 0.0; CEff_Inv[iMarker] = 0.0;
5598  Cmu[iMarker] = 0.0;
5599 
5600  for (iDim = 0; iDim < nDim; iDim++) ForceInviscid[iDim] = 0.0;
5601  MomentInviscid[0] = 0.0; MomentInviscid[1] = 0.0; MomentInviscid[2] = 0.0;
5602  MomentX_Force[0] = 0.0; MomentX_Force[1] = 0.0; MomentX_Force[2] = 0.0;
5603  MomentY_Force[0] = 0.0; MomentY_Force[1] = 0.0; MomentY_Force[2] = 0.0;
5604  MomentZ_Force[0] = 0.0; MomentZ_Force[1] = 0.0; MomentZ_Force[2] = 0.0;
5605 
5606  NFPressOF = 0.0;
5607 
5608  Momentum = 0.0;
5609 
5610  /*--- Loop over the vertices to compute the forces ---*/
5611 
5612  for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
5613 
5614  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
5615 
5616  Pressure = node[iPoint]->GetPressure();
5617 
5618  CPressure[iMarker][iVertex] = (Pressure - RefPressure)*factor*RefArea;
5619 
5620  /*--- Note that the pressure coefficient is computed at the
5621  halo cells (for visualization purposes), but not the forces ---*/
5622 
5623  if ( (geometry->node[iPoint]->GetDomain()) && (Monitoring == YES) ) {
5624 
5625  Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
5626  Coord = geometry->node[iPoint]->GetCoord();
5627 
5628  /*--- Quadratic objective function for the near-field.
5629  This uses the infinity pressure regardless of Mach number. ---*/
5630 
5631  NFPressOF += 0.5*(Pressure - Pressure_Inf)*(Pressure - Pressure_Inf)*Normal[nDim-1];
5632 
5633  for (iDim = 0; iDim < nDim; iDim++) {
5634  MomentDist[iDim] = Coord[iDim] - Origin[iDim];
5635  }
5636 
5637  /*--- Axisymmetric simulations ---*/
5638 
5639  if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
5640  else AxiFactor = 1.0;
5641 
5642  /*--- Force computation, note the minus sign due to the
5643  orientation of the normal (outward) ---*/
5644 
5645  for (iDim = 0; iDim < nDim; iDim++) {
5646  Force[iDim] = -(Pressure - Pressure_Inf) * Normal[iDim] * factor * AxiFactor;
5647  ForceInviscid[iDim] += Force[iDim];
5648  }
5649 
5650  /*--- Moment with respect to the reference axis ---*/
5651 
5652  if (nDim == 3) {
5653  MomentInviscid[0] += (Force[2]*MomentDist[1]-Force[1]*MomentDist[2])/RefLength;
5654  MomentX_Force[1] += (-Force[1]*Coord[2]);
5655  MomentX_Force[2] += (Force[2]*Coord[1]);
5656 
5657  MomentInviscid[1] += (Force[0]*MomentDist[2]-Force[2]*MomentDist[0])/RefLength;
5658  MomentY_Force[2] += (-Force[2]*Coord[0]);
5659  MomentY_Force[0] += (Force[0]*Coord[2]);
5660  }
5661  MomentInviscid[2] += (Force[1]*MomentDist[0]-Force[0]*MomentDist[1])/RefLength;
5662  MomentZ_Force[0] += (-Force[0]*Coord[1]);
5663  MomentZ_Force[1] += (Force[1]*Coord[0]);
5664 
5665  if(Boundary == TRANSPIRATION){
5666  Density = node[iPoint]->GetDensity();
5667  MassFlow = 0.0;
5668  Velocity2 = 0.0;
5669  for (iDim = 0; iDim < nDim; iDim++) {
5670  Velocity[iDim] = node[iPoint]->GetVelocity(iDim);
5671  MassFlow -= Normal[iDim]*Velocity[iDim]*Density;
5672  Velocity2 += Velocity[iDim]*Velocity[iDim];
5673  }
5674  Momentum += abs(MassFlow*sqrt(Velocity2)*factor);
5675  }
5676 
5677  }
5678 
5679  }
5680 
5681  /*--- Project forces and store the non-dimensional coefficients ---*/
5682 
5683  if (Monitoring == YES) {
5684 
5685  if (Boundary != NEARFIELD_BOUNDARY) {
5686  if (nDim == 2) {
5687  CD_Inv[iMarker] = ForceInviscid[0]*cos(Alpha) + ForceInviscid[1]*sin(Alpha);
5688  CL_Inv[iMarker] = -ForceInviscid[0]*sin(Alpha) + ForceInviscid[1]*cos(Alpha);
5689  CEff_Inv[iMarker] = CL_Inv[iMarker] / (CD_Inv[iMarker]+EPS);
5690  CMz_Inv[iMarker] = MomentInviscid[2];
5691  CoPx_Inv[iMarker] = MomentZ_Force[1];
5692  CoPy_Inv[iMarker] = -MomentZ_Force[0];
5693  CFx_Inv[iMarker] = ForceInviscid[0];
5694  CFy_Inv[iMarker] = ForceInviscid[1];
5695  CT_Inv[iMarker] = -CFx_Inv[iMarker];
5696  CQ_Inv[iMarker] = -CMz_Inv[iMarker];
5697  CMerit_Inv[iMarker] = CT_Inv[iMarker] / (CQ_Inv[iMarker] + EPS);
5698  Cmu[iMarker] = Momentum;
5699  }
5700  if (nDim == 3) {
5701  CD_Inv[iMarker] = ForceInviscid[0]*cos(Alpha)*cos(Beta) + ForceInviscid[1]*sin(Beta) + ForceInviscid[2]*sin(Alpha)*cos(Beta);
5702  CL_Inv[iMarker] = -ForceInviscid[0]*sin(Alpha) + ForceInviscid[2]*cos(Alpha);
5703  CSF_Inv[iMarker] = -ForceInviscid[0]*sin(Beta)*cos(Alpha) + ForceInviscid[1]*cos(Beta) - ForceInviscid[2]*sin(Beta)*sin(Alpha);
5704  CEff_Inv[iMarker] = CL_Inv[iMarker] / (CD_Inv[iMarker] + EPS);
5705  CMx_Inv[iMarker] = MomentInviscid[0];
5706  CMy_Inv[iMarker] = MomentInviscid[1];
5707  CMz_Inv[iMarker] = MomentInviscid[2];
5708  CoPx_Inv[iMarker] = -MomentY_Force[0];
5709  CoPz_Inv[iMarker] = MomentY_Force[2];
5710  CFx_Inv[iMarker] = ForceInviscid[0];
5711  CFy_Inv[iMarker] = ForceInviscid[1];
5712  CFz_Inv[iMarker] = ForceInviscid[2];
5713  CT_Inv[iMarker] = -CFz_Inv[iMarker];
5714  CQ_Inv[iMarker] = -CMz_Inv[iMarker];
5715  CMerit_Inv[iMarker] = CT_Inv[iMarker] / (CQ_Inv[iMarker] + EPS);
5716  Cmu[iMarker] = Momentum;
5717  }
5718 
5719  AllBound_CD_Inv += CD_Inv[iMarker];
5720  AllBound_CL_Inv += CL_Inv[iMarker];
5721  AllBound_CSF_Inv += CSF_Inv[iMarker];
5723  AllBound_CMx_Inv += CMx_Inv[iMarker];
5724  AllBound_CMy_Inv += CMy_Inv[iMarker];
5725  AllBound_CMz_Inv += CMz_Inv[iMarker];
5726  AllBound_CoPx_Inv += CoPx_Inv[iMarker];
5727  AllBound_CoPy_Inv += CoPy_Inv[iMarker];
5728  AllBound_CoPz_Inv += CoPz_Inv[iMarker];
5729  AllBound_CFx_Inv += CFx_Inv[iMarker];
5730  AllBound_CFy_Inv += CFy_Inv[iMarker];
5731  AllBound_CFz_Inv += CFz_Inv[iMarker];
5732  AllBound_CT_Inv += CT_Inv[iMarker];
5733  AllBound_CQ_Inv += CQ_Inv[iMarker];
5735  AllBound_Cmu += Cmu[iMarker];
5736 
5737  /*--- Compute the coefficients per surface ---*/
5738 
5739  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
5740  Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
5741  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
5742  if (Marker_Tag == Monitoring_Tag) {
5743  Surface_CL_Inv[iMarker_Monitoring] += CL_Inv[iMarker];
5744  Surface_CD_Inv[iMarker_Monitoring] += CD_Inv[iMarker];
5745  Surface_CSF_Inv[iMarker_Monitoring] += CSF_Inv[iMarker];
5746  Surface_CEff_Inv[iMarker_Monitoring] = CL_Inv[iMarker] / (CD_Inv[iMarker] + EPS);
5747  Surface_CFx_Inv[iMarker_Monitoring] += CFx_Inv[iMarker];
5748  Surface_CFy_Inv[iMarker_Monitoring] += CFy_Inv[iMarker];
5749  Surface_CFz_Inv[iMarker_Monitoring] += CFz_Inv[iMarker];
5750  Surface_CMx_Inv[iMarker_Monitoring] += CMx_Inv[iMarker];
5751  Surface_CMy_Inv[iMarker_Monitoring] += CMy_Inv[iMarker];
5752  Surface_CMz_Inv[iMarker_Monitoring] += CMz_Inv[iMarker];
5753  Surface_Cmu[iMarker_Monitoring] += Cmu[iMarker];
5754  }
5755  }
5756 
5757  }
5758 
5759  /*--- At the Nearfield SU2 only cares about the pressure coeffient ---*/
5760 
5761  else {
5762  CNearFieldOF_Inv[iMarker] = NFPressOF;
5764  }
5765 
5766  }
5767 
5768 
5769  }
5770  }
5771 
5772 #ifdef HAVE_MPI
5773 
5774  /*--- Add AllBound information using all the nodes ---*/
5775 
5776  MyAllBound_CD_Inv = AllBound_CD_Inv; AllBound_CD_Inv = 0.0;
5777  MyAllBound_CL_Inv = AllBound_CL_Inv; AllBound_CL_Inv = 0.0;
5778  MyAllBound_CSF_Inv = AllBound_CSF_Inv; AllBound_CSF_Inv = 0.0;
5779  AllBound_CEff_Inv = 0.0;
5780  MyAllBound_CMx_Inv = AllBound_CMx_Inv; AllBound_CMx_Inv = 0.0;
5781  MyAllBound_CMy_Inv = AllBound_CMy_Inv; AllBound_CMy_Inv = 0.0;
5782  MyAllBound_CMz_Inv = AllBound_CMz_Inv; AllBound_CMz_Inv = 0.0;
5783  MyAllBound_CoPx_Inv = AllBound_CoPx_Inv; AllBound_CoPx_Inv = 0.0;
5784  MyAllBound_CoPy_Inv = AllBound_CoPy_Inv; AllBound_CoPy_Inv = 0.0;
5785  MyAllBound_CoPz_Inv = AllBound_CoPz_Inv; AllBound_CoPz_Inv = 0.0;
5786  MyAllBound_CFx_Inv = AllBound_CFx_Inv; AllBound_CFx_Inv = 0.0;
5787  MyAllBound_CFy_Inv = AllBound_CFy_Inv; AllBound_CFy_Inv = 0.0;
5788  MyAllBound_CFz_Inv = AllBound_CFz_Inv; AllBound_CFz_Inv = 0.0;
5789  MyAllBound_CT_Inv = AllBound_CT_Inv; AllBound_CT_Inv = 0.0;
5790  MyAllBound_CQ_Inv = AllBound_CQ_Inv; AllBound_CQ_Inv = 0.0;
5791  AllBound_CMerit_Inv = 0.0;
5792  MyAllBound_CNearFieldOF_Inv = AllBound_CNearFieldOF_Inv; AllBound_CNearFieldOF_Inv = 0.0;
5793  if(transp){MyAllBound_Cmu = AllBound_Cmu; AllBound_Cmu = 0.0;}
5794 
5811  SU2_MPI::Allreduce(&MyAllBound_CNearFieldOF_Inv, &AllBound_CNearFieldOF_Inv, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
5812  if(transp) SU2_MPI::Allreduce(&MyAllBound_Cmu, &AllBound_Cmu, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
5813 
5814  /*--- Add the forces on the surfaces using all the nodes ---*/
5815 
5816  MySurface_CL_Inv = new su2double[config->GetnMarker_Monitoring()];
5817  MySurface_CD_Inv = new su2double[config->GetnMarker_Monitoring()];
5818  MySurface_CSF_Inv = new su2double[config->GetnMarker_Monitoring()];
5819  MySurface_CEff_Inv = new su2double[config->GetnMarker_Monitoring()];
5820  MySurface_CFx_Inv = new su2double[config->GetnMarker_Monitoring()];
5821  MySurface_CFy_Inv = new su2double[config->GetnMarker_Monitoring()];
5822  MySurface_CFz_Inv = new su2double[config->GetnMarker_Monitoring()];
5823  MySurface_CMx_Inv = new su2double[config->GetnMarker_Monitoring()];
5824  MySurface_CMy_Inv = new su2double[config->GetnMarker_Monitoring()];
5825  MySurface_CMz_Inv = new su2double[config->GetnMarker_Monitoring()];
5826  if(transp) MySurface_Cmu = new su2double[config->GetnMarker_Monitoring()];
5827 
5828  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
5829  MySurface_CL_Inv[iMarker_Monitoring] = Surface_CL_Inv[iMarker_Monitoring];
5830  MySurface_CD_Inv[iMarker_Monitoring] = Surface_CD_Inv[iMarker_Monitoring];
5831  MySurface_CSF_Inv[iMarker_Monitoring] = Surface_CSF_Inv[iMarker_Monitoring];
5832  MySurface_CEff_Inv[iMarker_Monitoring] = Surface_CEff_Inv[iMarker_Monitoring];
5833  MySurface_CFx_Inv[iMarker_Monitoring] = Surface_CFx_Inv[iMarker_Monitoring];
5834  MySurface_CFy_Inv[iMarker_Monitoring] = Surface_CFy_Inv[iMarker_Monitoring];
5835  MySurface_CFz_Inv[iMarker_Monitoring] = Surface_CFz_Inv[iMarker_Monitoring];
5836  MySurface_CMx_Inv[iMarker_Monitoring] = Surface_CMx_Inv[iMarker_Monitoring];
5837  MySurface_CMy_Inv[iMarker_Monitoring] = Surface_CMy_Inv[iMarker_Monitoring];
5838  MySurface_CMz_Inv[iMarker_Monitoring] = Surface_CMz_Inv[iMarker_Monitoring];
5839  if(transp) MySurface_Cmu[iMarker_Monitoring] = Surface_Cmu[iMarker_Monitoring];
5840 
5841  Surface_CL_Inv[iMarker_Monitoring] = 0.0;
5842  Surface_CD_Inv[iMarker_Monitoring] = 0.0;
5843  Surface_CSF_Inv[iMarker_Monitoring] = 0.0;
5844  Surface_CEff_Inv[iMarker_Monitoring] = 0.0;
5845  Surface_CFx_Inv[iMarker_Monitoring] = 0.0;
5846  Surface_CFy_Inv[iMarker_Monitoring] = 0.0;
5847  Surface_CFz_Inv[iMarker_Monitoring] = 0.0;
5848  Surface_CMx_Inv[iMarker_Monitoring] = 0.0;
5849  Surface_CMy_Inv[iMarker_Monitoring] = 0.0;
5850  Surface_CMz_Inv[iMarker_Monitoring] = 0.0;
5851  if(transp) Surface_Cmu[iMarker_Monitoring] = 0.0;
5852  }
5853 
5857  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++)
5858  Surface_CEff_Inv[iMarker_Monitoring] = Surface_CL_Inv[iMarker_Monitoring] / (Surface_CD_Inv[iMarker_Monitoring] + EPS);
5865  if(transp) SU2_MPI::Allreduce(MySurface_Cmu, Surface_Cmu, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
5866 
5867  delete [] MySurface_CL_Inv; delete [] MySurface_CD_Inv; delete [] MySurface_CSF_Inv;
5868  delete [] MySurface_CEff_Inv; delete [] MySurface_CFx_Inv; delete [] MySurface_CFy_Inv;
5869  delete [] MySurface_CFz_Inv; delete [] MySurface_CMx_Inv; delete [] MySurface_CMy_Inv;
5870  delete [] MySurface_CMz_Inv;
5871  if(transp) delete [] MySurface_Cmu;
5872 
5873 #endif
5874 
5875  /*--- Update the total coefficients (note that all the nodes have the same value) ---*/
5876 
5880  Total_CEff = Total_CL / (Total_CD + EPS);
5895 
5896  /*--- Update the total coefficients per surface (note that all the nodes have the same value)---*/
5897 
5898  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
5899  Surface_CL[iMarker_Monitoring] = Surface_CL_Inv[iMarker_Monitoring];
5900  Surface_CD[iMarker_Monitoring] = Surface_CD_Inv[iMarker_Monitoring];
5901  Surface_CSF[iMarker_Monitoring] = Surface_CSF_Inv[iMarker_Monitoring];
5902  Surface_CEff[iMarker_Monitoring] = Surface_CL_Inv[iMarker_Monitoring] / (Surface_CD_Inv[iMarker_Monitoring] + EPS);
5903  Surface_CFx[iMarker_Monitoring] = Surface_CFx_Inv[iMarker_Monitoring];
5904  Surface_CFy[iMarker_Monitoring] = Surface_CFy_Inv[iMarker_Monitoring];
5905  Surface_CFz[iMarker_Monitoring] = Surface_CFz_Inv[iMarker_Monitoring];
5906  Surface_CMx[iMarker_Monitoring] = Surface_CMx_Inv[iMarker_Monitoring];
5907  Surface_CMy[iMarker_Monitoring] = Surface_CMy_Inv[iMarker_Monitoring];
5908  Surface_CMz[iMarker_Monitoring] = Surface_CMz_Inv[iMarker_Monitoring];
5909  }
5910 
5911 }
5912 
5914 
5915  unsigned long iVertex, iPoint;
5916  unsigned short iDim, iMarker, Boundary, Monitoring, iMarker_Monitoring;
5917  su2double *Normal = NULL, MomentDist[3] = {0.0,0.0,0.0}, *Coord, Area,
5918  factor, RefVel2, RefTemp, RefDensity, Mach2Vel, Mach_Motion,
5919  Force[3] = {0.0,0.0,0.0}, Velocity[3], MassFlow, Density;
5920  string Marker_Tag, Monitoring_Tag;
5921  su2double MomentX_Force[3] = {0.0,0.0,0.0}, MomentY_Force[3] = {0.0,0.0,0.0}, MomentZ_Force[3] = {0.0,0.0,0.0};
5922  su2double AxiFactor;
5923 
5924 #ifdef HAVE_MPI
5925  su2double MyAllBound_CD_Mnt, MyAllBound_CL_Mnt, MyAllBound_CSF_Mnt,
5926  MyAllBound_CMx_Mnt, MyAllBound_CMy_Mnt, MyAllBound_CMz_Mnt,
5927  MyAllBound_CoPx_Mnt, MyAllBound_CoPy_Mnt, MyAllBound_CoPz_Mnt,
5928  MyAllBound_CFx_Mnt, MyAllBound_CFy_Mnt, MyAllBound_CFz_Mnt, MyAllBound_CT_Mnt,
5929  MyAllBound_CQ_Mnt,
5930  *MySurface_CL_Mnt = NULL, *MySurface_CD_Mnt = NULL, *MySurface_CSF_Mnt = NULL,
5931  *MySurface_CEff_Mnt = NULL, *MySurface_CFx_Mnt = NULL, *MySurface_CFy_Mnt = NULL,
5932  *MySurface_CFz_Mnt = NULL,
5933  *MySurface_CMx_Mnt = NULL, *MySurface_CMy_Mnt = NULL, *MySurface_CMz_Mnt = NULL;
5934 #endif
5935 
5936  su2double Alpha = config->GetAoA()*PI_NUMBER/180.0;
5937  su2double Beta = config->GetAoS()*PI_NUMBER/180.0;
5938  su2double RefArea = config->GetRefArea();
5939  su2double RefLength = config->GetRefLength();
5940  su2double Gas_Constant = config->GetGas_ConstantND();
5941  su2double *Origin = NULL;
5942  if (config->GetnMarker_Monitoring() != 0){
5943  Origin = config->GetRefOriginMoment(0);
5944  }
5945  bool grid_movement = config->GetGrid_Movement();
5946  bool axisymmetric = config->GetAxisymmetric();
5947 
5948  /*--- Evaluate reference values for non-dimensionalization.
5949  For dynamic meshes, use the motion Mach number as a reference value
5950  for computing the force coefficients. Otherwise, use the freestream values,
5951  which is the standard convention. ---*/
5952 
5953  RefTemp = Temperature_Inf;
5954  RefDensity = Density_Inf;
5955  if (grid_movement) {
5956  Mach2Vel = sqrt(Gamma*Gas_Constant*RefTemp);
5957  Mach_Motion = config->GetMach_Motion();
5958  RefVel2 = (Mach_Motion*Mach2Vel)*(Mach_Motion*Mach2Vel);
5959  }
5960  else {
5961  RefVel2 = 0.0;
5962  for (iDim = 0; iDim < nDim; iDim++)
5963  RefVel2 += Velocity_Inf[iDim]*Velocity_Inf[iDim];
5964  }
5965 
5966  factor = 1.0 / (0.5*RefDensity*RefArea*RefVel2);
5967 
5968  /*-- Variables initialization ---*/
5969 
5970  AllBound_CD_Mnt = 0.0; AllBound_CL_Mnt = 0.0; AllBound_CSF_Mnt = 0.0;
5975  AllBound_CEff_Mnt = 0.0;
5976 
5977  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
5978  Surface_CL_Mnt[iMarker_Monitoring] = 0.0; Surface_CD_Mnt[iMarker_Monitoring] = 0.0;
5979  Surface_CSF_Mnt[iMarker_Monitoring] = 0.0; Surface_CEff_Mnt[iMarker_Monitoring] = 0.0;
5980  Surface_CFx_Mnt[iMarker_Monitoring] = 0.0; Surface_CFy_Mnt[iMarker_Monitoring] = 0.0;
5981  Surface_CFz_Mnt[iMarker_Monitoring] = 0.0;
5982  Surface_CMx_Mnt[iMarker_Monitoring] = 0.0; Surface_CMy_Mnt[iMarker_Monitoring] = 0.0; Surface_CMz_Mnt[iMarker_Monitoring] = 0.0;
5983  }
5984 
5985  /*--- Loop over the Inlet -Outlet Markers ---*/
5986 
5987  for (iMarker = 0; iMarker < nMarker; iMarker++) {
5988 
5989  Boundary = config->GetMarker_All_KindBC(iMarker);
5990  Monitoring = config->GetMarker_All_Monitoring(iMarker);
5991 
5992  /*--- Obtain the origin for the moment computation for a particular marker ---*/
5993 
5994  if (Monitoring == YES) {
5995  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
5996  Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
5997  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
5998  if (Marker_Tag == Monitoring_Tag)
5999  Origin = config->GetRefOriginMoment(iMarker_Monitoring);
6000  }
6001  }
6002 
6003  if ((Boundary == INLET_FLOW) || (Boundary == OUTLET_FLOW) ||
6004  (Boundary == ACTDISK_INLET) || (Boundary == ACTDISK_OUTLET)||
6005  (Boundary == ENGINE_INFLOW) || (Boundary == ENGINE_EXHAUST)) {
6006 
6007  /*--- Forces initialization at each Marker ---*/
6008 
6009  CD_Mnt[iMarker] = 0.0; CL_Mnt[iMarker] = 0.0; CSF_Mnt[iMarker] = 0.0;
6010  CFx_Mnt[iMarker] = 0.0; CFy_Mnt[iMarker] = 0.0; CFz_Mnt[iMarker] = 0.0;
6011  CMx_Mnt[iMarker] = 0.0; CMy_Mnt[iMarker] = 0.0; CMz_Mnt[iMarker] = 0.0;
6012  CoPx_Mnt[iMarker] = 0.0; CoPy_Mnt[iMarker] = 0.0; CoPz_Mnt[iMarker] = 0.0;
6013  CT_Mnt[iMarker] = 0.0; CQ_Mnt[iMarker] = 0.0; CMerit_Mnt[iMarker] = 0.0;
6014  CEff_Mnt[iMarker] = 0.0;
6015 
6016  for (iDim = 0; iDim < nDim; iDim++) ForceMomentum[iDim] = 0.0;
6017  MomentMomentum[0] = 0.0; MomentMomentum[1] = 0.0; MomentMomentum[2] = 0.0;
6018  MomentX_Force[0] = 0.0; MomentX_Force[1] = 0.0; MomentX_Force[2] = 0.0;
6019  MomentY_Force[0] = 0.0; MomentY_Force[1] = 0.0; MomentY_Force[2] = 0.0;
6020  MomentZ_Force[0] = 0.0; MomentZ_Force[1] = 0.0; MomentZ_Force[2] = 0.0;
6021 
6022  /*--- Loop over the vertices to compute the forces ---*/
6023 
6024  for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
6025 
6026  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
6027 
6028  /*--- Note that the pressure coefficient is computed at the
6029  halo cells (for visualization purposes), but not the forces ---*/
6030 
6031  if ( (geometry->node[iPoint]->GetDomain()) && (Monitoring == YES) ) {
6032 
6033  Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
6034  Coord = geometry->node[iPoint]->GetCoord();
6035  Density = node[iPoint]->GetDensity();
6036 
6037  /*--- Quadratic objective function for the near-field.
6038  This uses the infinity pressure regardless of Mach number. ---*/
6039 
6040  Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
6041 
6042  MassFlow = 0.0;
6043  for (iDim = 0; iDim < nDim; iDim++) {
6044  Velocity[iDim] = node[iPoint]->GetVelocity(iDim);
6045  MomentDist[iDim] = Coord[iDim] - Origin[iDim];
6046  MassFlow -= Normal[iDim]*Velocity[iDim]*Density;
6047  }
6048 
6049  /*--- Axisymmetric simulations ---*/
6050 
6051  if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
6052  else AxiFactor = 1.0;
6053 
6054  /*--- Force computation, note the minus sign due to the
6055  orientation of the normal (outward) ---*/
6056 
6057  for (iDim = 0; iDim < nDim; iDim++) {
6058  Force[iDim] = MassFlow * Velocity[iDim] * factor * AxiFactor;
6059  ForceMomentum[iDim] += Force[iDim];
6060  }
6061 
6062  /*--- Moment with respect to the reference axis ---*/
6063 
6064  if (iDim == 3) {
6065  MomentMomentum[0] += (Force[2]*MomentDist[1]-Force[1]*MomentDist[2])/RefLength;
6066  MomentX_Force[1] += (-Force[1]*Coord[2]);
6067  MomentX_Force[2] += (Force[2]*Coord[1]);
6068 
6069  MomentMomentum[1] += (Force[0]*MomentDist[2]-Force[2]*MomentDist[0])/RefLength;
6070  MomentY_Force[2] += (-Force[2]*Coord[0]);
6071  MomentY_Force[0] += (Force[0]*Coord[2]);
6072  }
6073  MomentMomentum[2] += (Force[1]*MomentDist[0]-Force[0]*MomentDist[1])/RefLength;
6074  MomentZ_Force[0] += (-Force[0]*Coord[1]);
6075  MomentZ_Force[1] += (Force[1]*Coord[0]);
6076 
6077  }
6078 
6079  }
6080 
6081  /*--- Project forces and store the non-dimensional coefficients ---*/
6082 
6083  if (Monitoring == YES) {
6084 
6085  if (nDim == 2) {
6086  CD_Mnt[iMarker] = ForceMomentum[0]*cos(Alpha) + ForceMomentum[1]*sin(Alpha);
6087  CL_Mnt[iMarker] = -ForceMomentum[0]*sin(Alpha) + ForceMomentum[1]*cos(Alpha);
6088  CEff_Mnt[iMarker] = CL_Mnt[iMarker] / (CD_Mnt[iMarker]+EPS);
6089  CFx_Mnt[iMarker] = ForceMomentum[0];
6090  CFy_Mnt[iMarker] = ForceMomentum[1];
6091  CMz_Mnt[iMarker] = MomentMomentum[2];
6092  CoPx_Mnt[iMarker] = MomentZ_Force[1];
6093  CoPy_Mnt[iMarker] = -MomentZ_Force[0];
6094  CT_Mnt[iMarker] = -CFx_Mnt[iMarker];
6095  CQ_Mnt[iMarker] = -CMz_Mnt[iMarker];
6096  CMerit_Mnt[iMarker] = CT_Mnt[iMarker] / (CQ_Mnt[iMarker] + EPS);
6097  }
6098  if (nDim == 3) {
6099  CD_Mnt[iMarker] = ForceMomentum[0]*cos(Alpha)*cos(Beta) + ForceMomentum[1]*sin(Beta) + ForceMomentum[2]*sin(Alpha)*cos(Beta);
6100  CL_Mnt[iMarker] = -ForceMomentum[0]*sin(Alpha) + ForceMomentum[2]*cos(Alpha);
6101  CSF_Mnt[iMarker] = -ForceMomentum[0]*sin(Beta)*cos(Alpha) + ForceMomentum[1]*cos(Beta) - ForceMomentum[2]*sin(Beta)*sin(Alpha);
6102  CEff_Mnt[iMarker] = CL_Mnt[iMarker] / (CD_Mnt[iMarker] + EPS);
6103  CFx_Mnt[iMarker] = ForceMomentum[0];
6104  CFy_Mnt[iMarker] = ForceMomentum[1];
6105  CFz_Mnt[iMarker] = ForceMomentum[2];
6106  CMx_Mnt[iMarker] = MomentMomentum[0];
6107  CMy_Mnt[iMarker] = MomentMomentum[1];
6108  CMz_Mnt[iMarker] = MomentMomentum[2];
6109  CoPx_Mnt[iMarker] = -MomentY_Force[0];
6110  CoPz_Mnt[iMarker] = MomentY_Force[2];
6111  CT_Mnt[iMarker] = -CFz_Mnt[iMarker];
6112  CQ_Mnt[iMarker] = -CMz_Mnt[iMarker];
6113  CMerit_Mnt[iMarker] = CT_Mnt[iMarker] / (CQ_Mnt[iMarker] + EPS);
6114  }
6115 
6116  AllBound_CD_Mnt += CD_Mnt[iMarker];
6117  AllBound_CL_Mnt += CL_Mnt[iMarker];
6118  AllBound_CSF_Mnt += CSF_Mnt[iMarker];
6120  AllBound_CFx_Mnt += CFx_Mnt[iMarker];
6121  AllBound_CFy_Mnt += CFy_Mnt[iMarker];
6122  AllBound_CFz_Mnt += CFz_Mnt[iMarker];
6123  AllBound_CMx_Mnt += CMx_Mnt[iMarker];
6124  AllBound_CMy_Mnt += CMy_Mnt[iMarker];
6125  AllBound_CMz_Mnt += CMz_Mnt[iMarker];
6126  AllBound_CoPy_Mnt += CoPy_Mnt[iMarker];
6127  AllBound_CoPz_Mnt += CoPz_Mnt[iMarker];
6128  AllBound_CT_Mnt += CT_Mnt[iMarker];
6129  AllBound_CQ_Mnt += CQ_Mnt[iMarker];
6131 
6132  /*--- Compute the coefficients per surface ---*/
6133 
6134  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
6135  Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
6136  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
6137  if (Marker_Tag == Monitoring_Tag) {
6138  Surface_CL_Mnt[iMarker_Monitoring] += CL_Mnt[iMarker];
6139  Surface_CD_Mnt[iMarker_Monitoring] += CD_Mnt[iMarker];
6140  Surface_CSF_Mnt[iMarker_Monitoring] += CSF_Mnt[iMarker];
6141  Surface_CEff_Mnt[iMarker_Monitoring] = CL_Mnt[iMarker] / (CD_Mnt[iMarker] + EPS);
6142  Surface_CFx_Mnt[iMarker_Monitoring] += CFx_Mnt[iMarker];
6143  Surface_CFy_Mnt[iMarker_Monitoring] += CFy_Mnt[iMarker];
6144  Surface_CFz_Mnt[iMarker_Monitoring] += CFz_Mnt[iMarker];
6145  Surface_CMx_Mnt[iMarker_Monitoring] += CMx_Mnt[iMarker];
6146  Surface_CMy_Mnt[iMarker_Monitoring] += CMy_Mnt[iMarker];
6147  Surface_CMz_Mnt[iMarker_Monitoring] += CMz_Mnt[iMarker];
6148  }
6149  }
6150 
6151  }
6152 
6153 
6154  }
6155  }
6156 
6157 #ifdef HAVE_MPI
6158 
6159  /*--- Add AllBound information using all the nodes ---*/
6160 
6161  MyAllBound_CD_Mnt = AllBound_CD_Mnt; AllBound_CD_Mnt = 0.0;
6162  MyAllBound_CL_Mnt = AllBound_CL_Mnt; AllBound_CL_Mnt = 0.0;
6163  MyAllBound_CSF_Mnt = AllBound_CSF_Mnt; AllBound_CSF_Mnt = 0.0;
6164  MyAllBound_CFx_Mnt = AllBound_CFx_Mnt; AllBound_CFx_Mnt = 0.0;
6165  MyAllBound_CFy_Mnt = AllBound_CFy_Mnt; AllBound_CFy_Mnt = 0.0;
6166  MyAllBound_CFz_Mnt = AllBound_CFz_Mnt; AllBound_CFz_Mnt = 0.0;
6167  MyAllBound_CMx_Mnt = AllBound_CMx_Mnt; AllBound_CMx_Mnt = 0.0;
6168  MyAllBound_CMy_Mnt = AllBound_CMy_Mnt; AllBound_CMy_Mnt = 0.0;
6169  MyAllBound_CMz_Mnt = AllBound_CMz_Mnt; AllBound_CMz_Mnt = 0.0;
6170  MyAllBound_CoPx_Mnt = AllBound_CoPx_Mnt; AllBound_CoPx_Mnt = 0.0;
6171  MyAllBound_CoPy_Mnt = AllBound_CoPy_Mnt; AllBound_CoPy_Mnt = 0.0;
6172  MyAllBound_CoPz_Mnt = AllBound_CoPz_Mnt; AllBound_CoPz_Mnt = 0.0;
6173  MyAllBound_CT_Mnt = AllBound_CT_Mnt; AllBound_CT_Mnt = 0.0;
6174  MyAllBound_CQ_Mnt = AllBound_CQ_Mnt; AllBound_CQ_Mnt = 0.0;
6175 
6192 
6193  /*--- Add the forces on the surfaces using all the nodes ---*/
6194 
6195  MySurface_CL_Mnt = new su2double[config->GetnMarker_Monitoring()];
6196  MySurface_CD_Mnt = new su2double[config->GetnMarker_Monitoring()];
6197  MySurface_CSF_Mnt = new su2double[config->GetnMarker_Monitoring()];
6198  MySurface_CEff_Mnt = new su2double[config->GetnMarker_Monitoring()];
6199  MySurface_CFx_Mnt = new su2double[config->GetnMarker_Monitoring()];
6200  MySurface_CFy_Mnt = new su2double[config->GetnMarker_Monitoring()];
6201  MySurface_CFz_Mnt = new su2double[config->GetnMarker_Monitoring()];
6202  MySurface_CMx_Mnt = new su2double[config->GetnMarker_Monitoring()];
6203  MySurface_CMy_Mnt = new su2double[config->GetnMarker_Monitoring()];
6204  MySurface_CMz_Mnt = new su2double[config->GetnMarker_Monitoring()];
6205 
6206  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
6207  MySurface_CL_Mnt[iMarker_Monitoring] = Surface_CL_Mnt[iMarker_Monitoring];
6208  MySurface_CD_Mnt[iMarker_Monitoring] = Surface_CD_Mnt[iMarker_Monitoring];
6209  MySurface_CSF_Mnt[iMarker_Monitoring] = Surface_CSF_Mnt[iMarker_Monitoring];
6210  MySurface_CEff_Mnt[iMarker_Monitoring] = Surface_CEff_Mnt[iMarker_Monitoring];
6211  MySurface_CFx_Mnt[iMarker_Monitoring] = Surface_CFx_Mnt[iMarker_Monitoring];
6212  MySurface_CFy_Mnt[iMarker_Monitoring] = Surface_CFy_Mnt[iMarker_Monitoring];
6213  MySurface_CFz_Mnt[iMarker_Monitoring] = Surface_CFz_Mnt[iMarker_Monitoring];
6214  MySurface_CMx_Mnt[iMarker_Monitoring] = Surface_CMx_Mnt[iMarker_Monitoring];
6215  MySurface_CMy_Mnt[iMarker_Monitoring] = Surface_CMy_Mnt[iMarker_Monitoring];
6216  MySurface_CMz_Mnt[iMarker_Monitoring] = Surface_CMz_Mnt[iMarker_Monitoring];
6217 
6218  Surface_CL_Mnt[iMarker_Monitoring] = 0.0;
6219  Surface_CD_Mnt[iMarker_Monitoring] = 0.0;
6220  Surface_CSF_Mnt[iMarker_Monitoring] = 0.0;
6221  Surface_CEff_Mnt[iMarker_Monitoring] = 0.0;
6222  Surface_CFx_Mnt[iMarker_Monitoring] = 0.0;
6223  Surface_CFy_Mnt[iMarker_Monitoring] = 0.0;
6224  Surface_CFz_Mnt[iMarker_Monitoring] = 0.0;
6225  Surface_CMx_Mnt[iMarker_Monitoring] = 0.0;
6226  Surface_CMy_Mnt[iMarker_Monitoring] = 0.0;
6227  Surface_CMz_Mnt[iMarker_Monitoring] = 0.0;
6228  }
6229 
6233  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++)
6234  Surface_CEff_Mnt[iMarker_Monitoring] = Surface_CL_Mnt[iMarker_Monitoring] / (Surface_CD_Mnt[iMarker_Monitoring] + EPS);
6241 
6242  delete [] MySurface_CL_Mnt; delete [] MySurface_CD_Mnt; delete [] MySurface_CSF_Mnt;
6243  delete [] MySurface_CEff_Mnt; delete [] MySurface_CFx_Mnt; delete [] MySurface_CFy_Mnt;
6244  delete [] MySurface_CFz_Mnt;
6245  delete [] MySurface_CMx_Mnt; delete [] MySurface_CMy_Mnt; delete [] MySurface_CMz_Mnt;
6246 
6247 #endif
6248 
6249  /*--- Update the total coefficients (note that all the nodes have the same value) ---*/
6250 
6254  Total_CEff = Total_CL / (Total_CD + EPS);
6267 
6268  /*--- Update the total coefficients per surface (note that all the nodes have the same value)---*/
6269 
6270  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
6271  Surface_CL[iMarker_Monitoring] += Surface_CL_Mnt[iMarker_Monitoring];
6272  Surface_CD[iMarker_Monitoring] += Surface_CD_Mnt[iMarker_Monitoring];
6273  Surface_CSF[iMarker_Monitoring] += Surface_CSF_Mnt[iMarker_Monitoring];
6274  Surface_CEff[iMarker_Monitoring] += Surface_CL_Mnt[iMarker_Monitoring] / (Surface_CD_Mnt[iMarker_Monitoring] + EPS);
6275  Surface_CFx[iMarker_Monitoring] += Surface_CFx_Mnt[iMarker_Monitoring];
6276  Surface_CFy[iMarker_Monitoring] += Surface_CFy_Mnt[iMarker_Monitoring];
6277  Surface_CFz[iMarker_Monitoring] += Surface_CFz_Mnt[iMarker_Monitoring];
6278  Surface_CMx[iMarker_Monitoring] += Surface_CMx_Mnt[iMarker_Monitoring];
6279  Surface_CMy[iMarker_Monitoring] += Surface_CMy_Mnt[iMarker_Monitoring];
6280  Surface_CMz[iMarker_Monitoring] += Surface_CMz_Mnt[iMarker_Monitoring];
6281  }
6282 
6283 }
6284 
6285 void CEulerSolver::ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver_container,
6286  CConfig *config, unsigned short iRKStep) {
6287  su2double *Residual, *Res_TruncError, Vol, Delta, Res;
6288  unsigned short iVar;
6289  unsigned long iPoint;
6290 
6291  su2double RK_AlphaCoeff = config->Get_Alpha_RKStep(iRKStep);
6292  bool adjoint = config->GetContinuous_Adjoint();
6293 
6294  for (iVar = 0; iVar < nVar; iVar++) {
6295  SetRes_RMS(iVar, 0.0);
6296  SetRes_Max(iVar, 0.0, 0);
6297  }
6298 
6299  /*--- Update the solution ---*/
6300 
6301  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
6302  Vol = geometry->node[iPoint]->GetVolume();
6303  Delta = node[iPoint]->GetDelta_Time() / Vol;
6304 
6305  Res_TruncError = node[iPoint]->GetResTruncError();
6306  Residual = LinSysRes.GetBlock(iPoint);
6307 
6308  if (!adjoint) {
6309  for (iVar = 0; iVar < nVar; iVar++) {
6310  Res = Residual[iVar] + Res_TruncError[iVar];
6311  node[iPoint]->AddSolution(iVar, -Res*Delta*RK_AlphaCoeff);
6312  AddRes_RMS(iVar, Res*Res);
6313  AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
6314  }
6315  }
6316 
6317  }
6318 
6319  /*--- MPI solution ---*/
6320 
6321  Set_MPI_Solution(geometry, config);
6322 
6323  /*--- Compute the root mean square residual ---*/
6324 
6325  SetResidual_RMS(geometry, config);
6326 
6327 
6328 }
6329 
6330 void CEulerSolver::ClassicalRK4_Iteration(CGeometry *geometry, CSolver **solver_container,
6331  CConfig *config, unsigned short iRKStep) {
6332  su2double *Residual, *Res_TruncError, Vol, Delta, Res, tmp_time, tmp_func;
6333  unsigned short iVar;
6334  unsigned long iPoint;
6335 
6336  /*--- Hard-coded classical RK4 coefficients. Will be added to config. ---*/
6337  su2double RK_FuncCoeff[4] = {1.0/6.0, 1.0/3.0, 1.0/3.0, 1.0/6.0};
6338  su2double RK_TimeCoeff[4] = {0.5, 0.5, 1.0, 1.0};
6339 
6340  bool adjoint = config->GetContinuous_Adjoint();
6341 
6342  for (iVar = 0; iVar < nVar; iVar++) {
6343  SetRes_RMS(iVar, 0.0);
6344  SetRes_Max(iVar, 0.0, 0);
6345  }
6346 
6347  /*--- Update the solution ---*/
6348 
6349  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
6350 
6351  Vol = geometry->node[iPoint]->GetVolume();
6352  Delta = node[iPoint]->GetDelta_Time() / Vol;
6353 
6354  Res_TruncError = node[iPoint]->GetResTruncError();
6355  Residual = LinSysRes.GetBlock(iPoint);
6356 
6357  tmp_time = -1.0*RK_TimeCoeff[iRKStep]*Delta;
6358  tmp_func = -1.0*RK_FuncCoeff[iRKStep]*Delta;
6359 
6360  if (!adjoint) {
6361  for (iVar = 0; iVar < nVar; iVar++) {
6362  Res = Residual[iVar] + Res_TruncError[iVar];
6363  if (iRKStep < 3) {
6364  /* Base Solution Update */
6365  node[iPoint]->AddSolution(iVar, tmp_time*Res);
6366 
6367  /* New Solution Update */
6368  node[iPoint]->AddSolution_New(iVar, tmp_func*Res);
6369  } else {
6370  node[iPoint]->SetSolution(iVar, node[iPoint]->GetSolution_New(iVar) + tmp_func*Res);
6371  }
6372 
6373  AddRes_RMS(iVar, Res*Res);
6374  AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
6375  }
6376  }
6377 
6378  }
6379 
6380  /*--- MPI solution ---*/
6381 
6382  Set_MPI_Solution(geometry, config);
6383 
6384  /*--- Compute the root mean square residual ---*/
6385 
6386  SetResidual_RMS(geometry, config);
6387 
6388 }
6389 
6390 void CEulerSolver::ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) {
6391  su2double *local_Residual, *local_Res_TruncError, Vol, Delta, Res;
6392  unsigned short iVar;
6393  unsigned long iPoint;
6394 
6395  bool adjoint = config->GetContinuous_Adjoint();
6396 
6397  for (iVar = 0; iVar < nVar; iVar++) {
6398  SetRes_RMS(iVar, 0.0);
6399  SetRes_Max(iVar, 0.0, 0);
6400  }
6401 
6402  /*--- Update the solution ---*/
6403 
6404  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
6405  Vol = geometry->node[iPoint]->GetVolume();
6406  Delta = node[iPoint]->GetDelta_Time() / Vol;
6407 
6408  local_Res_TruncError = node[iPoint]->GetResTruncError();
6409  local_Residual = LinSysRes.GetBlock(iPoint);
6410 
6411  if (!adjoint) {
6412  for (iVar = 0; iVar < nVar; iVar++) {
6413  Res = local_Residual[iVar] + local_Res_TruncError[iVar];
6414  node[iPoint]->AddSolution(iVar, -Res*Delta);
6415  AddRes_RMS(iVar, Res*Res);
6416  AddRes_Max(iVar, fabs(Res), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
6417  }
6418  }
6419 
6420  }
6421 
6422  /*--- MPI solution ---*/
6423 
6424  Set_MPI_Solution(geometry, config);
6425 
6426  /*--- Compute the root mean square residual ---*/
6427 
6428  SetResidual_RMS(geometry, config);
6429 
6430 }
6431 
6432 void CEulerSolver::ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config) {
6433 
6434  unsigned short iVar, jVar;
6435  unsigned long iPoint, total_index, IterLinSol = 0;
6436  su2double Delta, *local_Res_TruncError, Vol;
6437 
6438  bool adjoint = config->GetContinuous_Adjoint();
6439  bool roe_turkel = config->GetKind_Upwind_Flow() == TURKEL;
6440  bool low_mach_prec = config->Low_Mach_Preconditioning();
6441 
6442  /*--- Set maximum residual to zero ---*/
6443 
6444  for (iVar = 0; iVar < nVar; iVar++) {
6445  SetRes_RMS(iVar, 0.0);
6446  SetRes_Max(iVar, 0.0, 0);
6447  }
6448 
6449  /*--- Build implicit system ---*/
6450 
6451  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
6452 
6453  /*--- Read the residual ---*/
6454 
6455  local_Res_TruncError = node[iPoint]->GetResTruncError();
6456 
6457  /*--- Read the volume ---*/
6458 
6459  Vol = geometry->node[iPoint]->GetVolume();
6460 
6461  /*--- Modify matrix diagonal to assure diagonal dominance ---*/
6462 
6463 
6464  if (node[iPoint]->GetDelta_Time() != 0.0) {
6465  Delta = Vol / node[iPoint]->GetDelta_Time();
6466  if (roe_turkel || low_mach_prec) {
6467  SetPreconditioner(config, iPoint);
6468  for (iVar = 0; iVar < nVar; iVar ++ )
6469  for (jVar = 0; jVar < nVar; jVar ++ )
6470  LowMach_Precontioner[iVar][jVar] = Delta*LowMach_Precontioner[iVar][jVar];
6471  Jacobian.AddBlock(iPoint, iPoint, LowMach_Precontioner);
6472  }
6473  else {
6474  Jacobian.AddVal2Diag(iPoint, Delta);
6475  }
6476  }
6477  else {
6478  Jacobian.SetVal2Diag(iPoint, 1.0);
6479  for (iVar = 0; iVar < nVar; iVar++) {
6480  total_index = iPoint*nVar + iVar;
6481  LinSysRes[total_index] = 0.0;
6482  local_Res_TruncError[iVar] = 0.0;
6483  }
6484  }
6485 
6486  /*--- Right hand side of the system (-Residual) and initial guess (x = 0) ---*/
6487 
6488  for (iVar = 0; iVar < nVar; iVar++) {
6489  total_index = iPoint*nVar + iVar;
6490  LinSysRes[total_index] = - (LinSysRes[total_index] + local_Res_TruncError[iVar]);
6491  LinSysSol[total_index] = 0.0;
6492  AddRes_RMS(iVar, LinSysRes[total_index]*LinSysRes[total_index]);
6493  AddRes_Max(iVar, fabs(LinSysRes[total_index]), geometry->node[iPoint]->GetGlobalIndex(), geometry->node[iPoint]->GetCoord());
6494  }
6495  }
6496 
6497  /*--- Initialize residual and solution at the ghost points ---*/
6498 
6499  for (iPoint = nPointDomain; iPoint < nPoint; iPoint++) {
6500  for (iVar = 0; iVar < nVar; iVar++) {
6501  total_index = iPoint*nVar + iVar;
6502  LinSysRes[total_index] = 0.0;
6503  LinSysSol[total_index] = 0.0;
6504  }
6505  }
6506 
6507  /*--- Solve or smooth the linear system ---*/
6508 
6509  CSysSolve system;
6510  IterLinSol = system.Solve(Jacobian, LinSysRes, LinSysSol, geometry, config);
6511 
6512  /*--- The the number of iterations of the linear solver ---*/
6513 
6514  SetIterLinSolver(IterLinSol);
6515 
6516  /*--- Update solution (system written in terms of increments) ---*/
6517 
6518  if (!adjoint) {
6519  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
6520  for (iVar = 0; iVar < nVar; iVar++) {
6521  node[iPoint]->AddSolution(iVar, config->GetRelaxation_Factor_Flow()*LinSysSol[iPoint*nVar+iVar]);
6522  }
6523  }
6524  }
6525 
6526  /*--- MPI solution ---*/
6527 
6528  Set_MPI_Solution(geometry, config);
6529 
6530  /*--- Compute the root mean square residual ---*/
6531 
6532  SetResidual_RMS(geometry, config);
6533 
6534 }
6535 
6537  unsigned long iPoint, jPoint, iEdge, iVertex;
6538  unsigned short iDim, iVar, iMarker;
6539  su2double *PrimVar_Vertex, *PrimVar_i, *PrimVar_j, PrimVar_Average,
6540  Partial_Gradient, Partial_Res, *Normal;
6541 
6542  /*--- Gradient primitive variables compressible (temp, vx, vy, vz, P, rho) ---*/
6543 
6544  PrimVar_Vertex = new su2double [nPrimVarGrad];
6547 
6548  /*--- Set Gradient_Primitive to zero ---*/
6549 
6550  for (iPoint = 0; iPoint < nPointDomain; iPoint++)
6551  node[iPoint]->SetGradient_PrimitiveZero(nPrimVarGrad);
6552 
6553  /*--- Loop interior edges ---*/
6554 
6555  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
6556  iPoint = geometry->edge[iEdge]->GetNode(0);
6557  jPoint = geometry->edge[iEdge]->GetNode(1);
6558 
6559  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6560  PrimVar_i[iVar] = node[iPoint]->GetPrimitive(iVar);
6561  PrimVar_j[iVar] = node[jPoint]->GetPrimitive(iVar);
6562  }
6563 
6564  Normal = geometry->edge[iEdge]->GetNormal();
6565  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6566  PrimVar_Average = 0.5 * ( PrimVar_i[iVar] + PrimVar_j[iVar] );
6567  for (iDim = 0; iDim < nDim; iDim++) {
6568  Partial_Res = PrimVar_Average*Normal[iDim];
6569  if (geometry->node[iPoint]->GetDomain())
6570  node[iPoint]->AddGradient_Primitive(iVar, iDim, Partial_Res);
6571  if (geometry->node[jPoint]->GetDomain())
6572  node[jPoint]->SubtractGradient_Primitive(iVar, iDim, Partial_Res);
6573  }
6574  }
6575  }
6576 
6577  /*--- Loop boundary edges ---*/
6578 
6579  for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
6580  if (config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY &&
6581  config->GetMarker_All_KindBC(iMarker) != PERIODIC_BOUNDARY)
6582  for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
6583  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
6584  if (geometry->node[iPoint]->GetDomain()) {
6585 
6586  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
6587  PrimVar_Vertex[iVar] = node[iPoint]->GetPrimitive(iVar);
6588 
6589  Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
6590  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
6591  for (iDim = 0; iDim < nDim; iDim++) {
6592  Partial_Res = PrimVar_Vertex[iVar]*Normal[iDim];
6593  node[iPoint]->SubtractGradient_Primitive(iVar, iDim, Partial_Res);
6594  }
6595  }
6596  }
6597  }
6598 
6599  /*--- Update gradient value ---*/
6600 
6601  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
6602  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6603  for (iDim = 0; iDim < nDim; iDim++) {
6604  Partial_Gradient = node[iPoint]->GetGradient_Primitive(iVar, iDim) / (geometry->node[iPoint]->GetVolume());
6605  node[iPoint]->SetGradient_Primitive(iVar, iDim, Partial_Gradient);
6606  }
6607  }
6608  }
6609 
6610  delete [] PrimVar_Vertex;
6611  delete [] PrimVar_i;
6612  delete [] PrimVar_j;
6613 
6614  Set_MPI_Primitive_Gradient(geometry, config);
6615 
6616 }
6617 
6619 
6620  unsigned short iVar, iDim, jDim, iNeigh;
6621  unsigned long iPoint, jPoint;
6622  su2double *PrimVar_i, *PrimVar_j, *Coord_i, *Coord_j, r11, r12, r13, r22, r23, r23_a,
6623  r23_b, r33, weight, product, z11, z12, z13, z22, z23, z33, detR2;
6624  bool singular;
6625 
6626  /*--- Loop over points of the grid ---*/
6627 
6628  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
6629 
6630  /*--- Set the value of the singular ---*/
6631  singular = false;
6632 
6633  /*--- Get coordinates ---*/
6634 
6635  Coord_i = geometry->node[iPoint]->GetCoord();
6636 
6637  /*--- Get primitives from CVariable ---*/
6638 
6639  PrimVar_i = node[iPoint]->GetPrimitive();
6640 
6641  /*--- Inizialization of variables ---*/
6642 
6643  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
6644  for (iDim = 0; iDim < nDim; iDim++)
6645  Cvector[iVar][iDim] = 0.0;
6646 
6647  r11 = 0.0; r12 = 0.0; r13 = 0.0; r22 = 0.0;
6648  r23 = 0.0; r23_a = 0.0; r23_b = 0.0; r33 = 0.0;
6649 
6650  AD::StartPreacc();
6652  AD::SetPreaccIn(Coord_i, nDim);
6653 
6654  for (iNeigh = 0; iNeigh < geometry->node[iPoint]->GetnPoint(); iNeigh++) {
6655  jPoint = geometry->node[iPoint]->GetPoint(iNeigh);
6656  Coord_j = geometry->node[jPoint]->GetCoord();
6657 
6658  PrimVar_j = node[jPoint]->GetPrimitive();
6659 
6660  AD::SetPreaccIn(Coord_j, nDim);
6662 
6663  weight = 0.0;
6664  for (iDim = 0; iDim < nDim; iDim++)
6665  weight += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
6666 
6667  /*--- Sumations for entries of upper triangular matrix R ---*/
6668 
6669  if (weight != 0.0) {
6670 
6671  r11 += (Coord_j[0]-Coord_i[0])*(Coord_j[0]-Coord_i[0])/weight;
6672  r12 += (Coord_j[0]-Coord_i[0])*(Coord_j[1]-Coord_i[1])/weight;
6673  r22 += (Coord_j[1]-Coord_i[1])*(Coord_j[1]-Coord_i[1])/weight;
6674 
6675  if (nDim == 3) {
6676  r13 += (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight;
6677  r23_a += (Coord_j[1]-Coord_i[1])*(Coord_j[2]-Coord_i[2])/weight;
6678  r23_b += (Coord_j[0]-Coord_i[0])*(Coord_j[2]-Coord_i[2])/weight;
6679  r33 += (Coord_j[2]-Coord_i[2])*(Coord_j[2]-Coord_i[2])/weight;
6680  }
6681 
6682  /*--- Entries of c:= transpose(A)*b ---*/
6683 
6684  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
6685  for (iDim = 0; iDim < nDim; iDim++)
6686  Cvector[iVar][iDim] += (Coord_j[iDim]-Coord_i[iDim])*(PrimVar_j[iVar]-PrimVar_i[iVar])/weight;
6687 
6688  }
6689 
6690  }
6691 
6692  /*--- Entries of upper triangular matrix R ---*/
6693 
6694  if (r11 >= 0.0) r11 = sqrt(r11); else r11 = 0.0;
6695  if (r11 != 0.0) r12 = r12/r11; else r12 = 0.0;
6696  if (r22-r12*r12 >= 0.0) r22 = sqrt(r22-r12*r12); else r22 = 0.0;
6697 
6698  if (nDim == 3) {
6699  if (r11 != 0.0) r13 = r13/r11; else r13 = 0.0;
6700  if ((r22 != 0.0) && (r11*r22 != 0.0)) r23 = r23_a/r22 - r23_b*r12/(r11*r22); else r23 = 0.0;
6701  if (r33-r23*r23-r13*r13 >= 0.0) r33 = sqrt(r33-r23*r23-r13*r13); else r33 = 0.0;
6702  }
6703 
6704  /*--- Compute determinant ---*/
6705 
6706  if (nDim == 2) detR2 = (r11*r22)*(r11*r22);
6707  else detR2 = (r11*r22*r33)*(r11*r22*r33);
6708 
6709  /*--- Detect singular matrices ---*/
6710 
6711  if (abs(detR2) <= EPS) { detR2 = 1.0; singular = true; }
6712 
6713  /*--- S matrix := inv(R)*traspose(inv(R)) ---*/
6714 
6715  if (singular) {
6716  for (iDim = 0; iDim < nDim; iDim++)
6717  for (jDim = 0; jDim < nDim; jDim++)
6718  Smatrix[iDim][jDim] = 0.0;
6719  }
6720  else {
6721  if (nDim == 2) {
6722  Smatrix[0][0] = (r12*r12+r22*r22)/detR2;
6723  Smatrix[0][1] = -r11*r12/detR2;
6724  Smatrix[1][0] = Smatrix[0][1];
6725  Smatrix[1][1] = r11*r11/detR2;
6726  }
6727  else {
6728  z11 = r22*r33; z12 = -r12*r33; z13 = r12*r23-r13*r22;
6729  z22 = r11*r33; z23 = -r11*r23; z33 = r11*r22;
6730  Smatrix[0][0] = (z11*z11+z12*z12+z13*z13)/detR2;
6731  Smatrix[0][1] = (z12*z22+z13*z23)/detR2;
6732  Smatrix[0][2] = (z13*z33)/detR2;
6733  Smatrix[1][0] = Smatrix[0][1];
6734  Smatrix[1][1] = (z22*z22+z23*z23)/detR2;
6735  Smatrix[1][2] = (z23*z33)/detR2;
6736  Smatrix[2][0] = Smatrix[0][2];
6737  Smatrix[2][1] = Smatrix[1][2];
6738  Smatrix[2][2] = (z33*z33)/detR2;
6739  }
6740  }
6741 
6742  /*--- Computation of the gradient: S*c ---*/
6743  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6744  for (iDim = 0; iDim < nDim; iDim++) {
6745  product = 0.0;
6746  for (jDim = 0; jDim < nDim; jDim++) {
6747  product += Smatrix[iDim][jDim]*Cvector[iVar][jDim];
6748  }
6749 
6750  node[iPoint]->SetGradient_Primitive(iVar, iDim, product);
6751  }
6752  }
6753 
6754  AD::SetPreaccOut(node[iPoint]->GetGradient_Primitive(), nPrimVarGrad, nDim);
6755  AD::EndPreacc();
6756  }
6757 
6758  Set_MPI_Primitive_Gradient(geometry, config);
6759 
6760 }
6761 
6763 
6764  unsigned long iEdge, iPoint, jPoint;
6765  unsigned short iVar, iDim;
6766  su2double **Gradient_i, **Gradient_j, *Coord_i, *Coord_j,
6767  *Primitive, *Primitive_i, *Primitive_j, *LocalMinPrimitive, *LocalMaxPrimitive,
6768  *GlobalMinPrimitive, *GlobalMaxPrimitive,
6769  dave, LimK, eps2, eps1, dm, dp, du, y, limiter;
6770 
6771  dave = config->GetRefElemLength();
6772  LimK = config->GetVenkat_LimiterCoeff();
6773 
6774  if (config->GetKind_SlopeLimit_Flow() == NO_LIMITER) {
6775 
6776  for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
6777  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6778  node[iPoint]->SetLimiter_Primitive(iVar, 1.0);
6779  }
6780  }
6781 
6782  }
6783 
6784  else {
6785 
6786  /*--- Initialize solution max and solution min and the limiter in the entire domain --*/
6787 
6788  for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
6789  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6790  node[iPoint]->SetSolution_Max(iVar, -EPS);
6791  node[iPoint]->SetSolution_Min(iVar, EPS);
6792  node[iPoint]->SetLimiter_Primitive(iVar, 2.0);
6793  }
6794  }
6795 
6796  /*--- Establish bounds for Spekreijse monotonicity by finding max & min values of neighbor variables --*/
6797 
6798  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
6799 
6800  /*--- Point identification, Normal vector and area ---*/
6801 
6802  iPoint = geometry->edge[iEdge]->GetNode(0);
6803  jPoint = geometry->edge[iEdge]->GetNode(1);
6804 
6805  /*--- Get the primitive variables ---*/
6806 
6807  Primitive_i = node[iPoint]->GetPrimitive();
6808  Primitive_j = node[jPoint]->GetPrimitive();
6809 
6810  /*--- Compute the maximum, and minimum values for nodes i & j ---*/
6811 
6812  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6813  du = (Primitive_j[iVar] - Primitive_i[iVar]);
6814  node[iPoint]->SetSolution_Min(iVar, min(node[iPoint]->GetSolution_Min(iVar), du));
6815  node[iPoint]->SetSolution_Max(iVar, max(node[iPoint]->GetSolution_Max(iVar), du));
6816  node[jPoint]->SetSolution_Min(iVar, min(node[jPoint]->GetSolution_Min(iVar), -du));
6817  node[jPoint]->SetSolution_Max(iVar, max(node[jPoint]->GetSolution_Max(iVar), -du));
6818  }
6819 
6820  }
6821 
6822  }
6823 
6824  /*--- Barth-Jespersen limiter with Venkatakrishnan modification ---*/
6825 
6826  if (config->GetKind_SlopeLimit_Flow() == BARTH_JESPERSEN) {
6827 
6828  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
6829 
6830  iPoint = geometry->edge[iEdge]->GetNode(0);
6831  jPoint = geometry->edge[iEdge]->GetNode(1);
6832  Gradient_i = node[iPoint]->GetGradient_Primitive();
6833  Gradient_j = node[jPoint]->GetGradient_Primitive();
6834  Coord_i = geometry->node[iPoint]->GetCoord();
6835  Coord_j = geometry->node[jPoint]->GetCoord();
6836 
6837  AD::StartPreacc();
6838  AD::SetPreaccIn(Gradient_i, nPrimVarGrad, nDim);
6839  AD::SetPreaccIn(Gradient_j, nPrimVarGrad, nDim);
6840  AD::SetPreaccIn(Coord_i, nDim); AD::SetPreaccIn(Coord_j, nDim);
6841 
6842  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6843 
6844  AD::SetPreaccIn(node[iPoint]->GetSolution_Max(iVar));
6845  AD::SetPreaccIn(node[iPoint]->GetSolution_Min(iVar));
6846  AD::SetPreaccIn(node[jPoint]->GetSolution_Max(iVar));
6847  AD::SetPreaccIn(node[jPoint]->GetSolution_Min(iVar));
6848 
6849  /*--- Calculate the interface left gradient, delta- (dm) ---*/
6850 
6851  dm = 0.0;
6852  for (iDim = 0; iDim < nDim; iDim++)
6853  dm += 0.5*(Coord_j[iDim]-Coord_i[iDim])*Gradient_i[iVar][iDim];
6854 
6855  if (dm == 0.0) { limiter = 2.0; }
6856  else {
6857  if ( dm > 0.0 ) dp = node[iPoint]->GetSolution_Max(iVar);
6858  else dp = node[iPoint]->GetSolution_Min(iVar);
6859  limiter = dp/dm;
6860  }
6861 
6862  if (limiter < node[iPoint]->GetLimiter_Primitive(iVar)) {
6863  node[iPoint]->SetLimiter_Primitive(iVar, limiter);
6864  AD::SetPreaccOut(node[iPoint]->GetLimiter_Primitive()[iVar]);
6865  }
6866 
6867  /*--- Calculate the interface right gradient, delta+ (dp) ---*/
6868 
6869  dm = 0.0;
6870  for (iDim = 0; iDim < nDim; iDim++)
6871  dm += 0.5*(Coord_i[iDim]-Coord_j[iDim])*Gradient_j[iVar][iDim];
6872 
6873  if (dm == 0.0) { limiter = 2.0; }
6874  else {
6875  if ( dm > 0.0 ) dp = node[jPoint]->GetSolution_Max(iVar);
6876  else dp = node[jPoint]->GetSolution_Min(iVar);
6877  limiter = dp/dm;
6878  }
6879 
6880  if (limiter < node[jPoint]->GetLimiter_Primitive(iVar)) {
6881  node[jPoint]->SetLimiter_Primitive(iVar, limiter);
6882  AD::SetPreaccOut(node[jPoint]->GetLimiter_Primitive()[iVar]);
6883  }
6884 
6885  }
6886 
6887  AD::EndPreacc();
6888 
6889  }
6890 
6891  for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
6892  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6893  y = node[iPoint]->GetLimiter_Primitive(iVar);
6894  limiter = (y*y + 2.0*y) / (y*y + y + 2.0);
6895  node[iPoint]->SetLimiter_Primitive(iVar, limiter);
6896  }
6897  }
6898 
6899  }
6900 
6901  /*--- Venkatakrishnan limiter ---*/
6902 
6903  if ((config->GetKind_SlopeLimit_Flow() == VENKATAKRISHNAN) ||
6905 
6906  /*--- Allocate memory for the max and min primitive value --*/
6907 
6908  LocalMinPrimitive = new su2double [nPrimVarGrad]; GlobalMinPrimitive = new su2double [nPrimVarGrad];
6909  LocalMaxPrimitive = new su2double [nPrimVarGrad]; GlobalMaxPrimitive = new su2double [nPrimVarGrad];
6910 
6911  /*--- Compute the max value and min value of the solution ---*/
6912 
6913  Primitive = node[0]->GetPrimitive();
6914  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6915  LocalMinPrimitive[iVar] = Primitive[iVar];
6916  LocalMaxPrimitive[iVar] = Primitive[iVar];
6917  }
6918 
6919  for (iPoint = 0; iPoint < geometry->GetnPoint(); iPoint++) {
6920 
6921  /*--- Get the primitive variables ---*/
6922 
6923  Primitive = node[iPoint]->GetPrimitive();
6924 
6925  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6926  LocalMinPrimitive[iVar] = min (LocalMinPrimitive[iVar], Primitive[iVar]);
6927  LocalMaxPrimitive[iVar] = max (LocalMaxPrimitive[iVar], Primitive[iVar]);
6928  }
6929 
6930  }
6931 
6932 #ifdef HAVE_MPI
6933  SU2_MPI::Allreduce(LocalMinPrimitive, GlobalMinPrimitive, nPrimVarGrad, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
6934  SU2_MPI::Allreduce(LocalMaxPrimitive, GlobalMaxPrimitive, nPrimVarGrad, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
6935 #else
6936  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6937  GlobalMinPrimitive[iVar] = LocalMinPrimitive[iVar];
6938  GlobalMaxPrimitive[iVar] = LocalMaxPrimitive[iVar];
6939  }
6940 #endif
6941 
6942  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
6943 
6944  iPoint = geometry->edge[iEdge]->GetNode(0);
6945  jPoint = geometry->edge[iEdge]->GetNode(1);
6946  Gradient_i = node[iPoint]->GetGradient_Primitive();
6947  Gradient_j = node[jPoint]->GetGradient_Primitive();
6948  Coord_i = geometry->node[iPoint]->GetCoord();
6949  Coord_j = geometry->node[jPoint]->GetCoord();
6950 
6951  AD::StartPreacc();
6952  AD::SetPreaccIn(Gradient_i, nPrimVarGrad, nDim);
6953  AD::SetPreaccIn(Gradient_j, nPrimVarGrad, nDim);
6954  AD::SetPreaccIn(Coord_i, nDim); AD::SetPreaccIn(Coord_j, nDim);
6955  AD::SetPreaccIn(eps2);
6956 
6957  for (iVar = 0; iVar < nPrimVarGrad; iVar++) {
6958 
6959  if (config->GetKind_SlopeLimit_Flow() == VENKATAKRISHNAN_WANG) {
6960  eps1 = LimK * (GlobalMaxPrimitive[iVar] - GlobalMinPrimitive[iVar]);
6961  eps2 = eps1*eps1;
6962  }
6963  else {
6964  eps1 = LimK*dave;
6965  eps2 = eps1*eps1*eps1;
6966  }
6967 
6968  AD::SetPreaccIn(node[iPoint]->GetSolution_Max(iVar));
6969  AD::SetPreaccIn(node[iPoint]->GetSolution_Min(iVar));
6970  AD::SetPreaccIn(node[jPoint]->GetSolution_Max(iVar));
6971  AD::SetPreaccIn(node[jPoint]->GetSolution_Min(iVar));
6972 
6973  /*--- Calculate the interface left gradient, delta- (dm) ---*/
6974 
6975  dm = 0.0;
6976  for (iDim = 0; iDim < nDim; iDim++)
6977  dm += 0.5*(Coord_j[iDim]-Coord_i[iDim])*Gradient_i[iVar][iDim];
6978 
6979  /*--- Calculate the interface right gradient, delta+ (dp) ---*/
6980 
6981  if ( dm > 0.0 ) dp = node[iPoint]->GetSolution_Max(iVar);
6982  else dp = node[iPoint]->GetSolution_Min(iVar);
6983 
6984  limiter = ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2);
6985 
6986  if (limiter < node[iPoint]->GetLimiter_Primitive(iVar)) {
6987  node[iPoint]->SetLimiter_Primitive(iVar, limiter);
6988  AD::SetPreaccOut(node[iPoint]->GetLimiter_Primitive()[iVar]);
6989  }
6990 
6991  /*-- Repeat for point j on the edge ---*/
6992 
6993  dm = 0.0;
6994  for (iDim = 0; iDim < nDim; iDim++)
6995  dm += 0.5*(Coord_i[iDim]-Coord_j[iDim])*Gradient_j[iVar][iDim];
6996 
6997  if ( dm > 0.0 ) dp = node[jPoint]->GetSolution_Max(iVar);
6998  else dp = node[jPoint]->GetSolution_Min(iVar);
6999 
7000  limiter = ( dp*dp + 2.0*dp*dm + eps2 )/( dp*dp + dp*dm + 2.0*dm*dm + eps2);
7001 
7002  if (limiter < node[jPoint]->GetLimiter_Primitive(iVar)) {
7003  node[jPoint]->SetLimiter_Primitive(iVar, limiter);
7004  AD::SetPreaccOut(node[jPoint]->GetLimiter_Primitive()[iVar]);
7005  }
7006 
7007  }
7008 
7009  AD::EndPreacc();
7010 
7011  }
7012 
7013  delete [] LocalMinPrimitive; delete [] GlobalMinPrimitive;
7014  delete [] LocalMaxPrimitive; delete [] GlobalMaxPrimitive;
7015 
7016  }
7017 
7018  /*--- Limiter MPI ---*/
7019 
7020  Set_MPI_Primitive_Limiter(geometry, config);
7021 
7022 }
7023 
7024 void CEulerSolver::SetPreconditioner(CConfig *config, unsigned long iPoint) {
7025  unsigned short iDim, jDim, iVar, jVar;
7026  su2double local_Mach, rho, enthalpy, soundspeed, sq_vel;
7027  su2double *U_i = NULL;
7028  su2double Beta_max = config->GetmaxTurkelBeta();
7029  su2double Mach_infty2, Mach_lim2, aux, parameter;
7030 
7031  /*--- Variables to calculate the preconditioner parameter Beta ---*/
7032  local_Mach = sqrt(node[iPoint]->GetVelocity2())/node[iPoint]->GetSoundSpeed();
7033 
7034  /*--- Weiss and Smith Preconditioning---*/
7035  Mach_infty2 = pow(config->GetMach(),2.0);
7036  Mach_lim2 = pow(0.00001,2.0);
7037  aux = max(pow(local_Mach,2.0),Mach_lim2);
7038  parameter = min(1.0, max(aux,Beta_max*Mach_infty2));
7039 
7040  U_i = node[iPoint]->GetSolution();
7041 
7042  rho = U_i[0];
7043  enthalpy = node[iPoint]->GetEnthalpy();
7044  soundspeed = node[iPoint]->GetSoundSpeed();
7045  sq_vel = node[iPoint]->GetVelocity2();
7046 
7047  /*---Calculating the inverse of the preconditioning matrix that multiplies the time derivative */
7048  LowMach_Precontioner[0][0] = 0.5*sq_vel;
7049  LowMach_Precontioner[0][nVar-1] = 1.0;
7050  for (iDim = 0; iDim < nDim; iDim ++)
7051  LowMach_Precontioner[0][1+iDim] = -1.0*U_i[iDim+1]/rho;
7052 
7053  for (iDim = 0; iDim < nDim; iDim ++) {
7054  LowMach_Precontioner[iDim+1][0] = 0.5*sq_vel*U_i[iDim+1]/rho;
7055  LowMach_Precontioner[iDim+1][nVar-1] = U_i[iDim+1]/rho;
7056  for (jDim = 0; jDim < nDim; jDim ++) {
7057  LowMach_Precontioner[iDim+1][1+jDim] = -1.0*U_i[jDim+1]/rho*U_i[iDim+1]/rho;
7058  }
7059  }
7060 
7061  LowMach_Precontioner[nVar-1][0] = 0.5*sq_vel*enthalpy;
7062  LowMach_Precontioner[nVar-1][nVar-1] = enthalpy;
7063  for (iDim = 0; iDim < nDim; iDim ++)
7064  LowMach_Precontioner[nVar-1][1+iDim] = -1.0*U_i[iDim+1]/rho*enthalpy;
7065 
7066 
7067  for (iVar = 0; iVar < nVar; iVar ++ ) {
7068  for (jVar = 0; jVar < nVar; jVar ++ ) {
7069  LowMach_Precontioner[iVar][jVar] = (parameter - 1.0) * ((Gamma-1.0)/(soundspeed*soundspeed))*LowMach_Precontioner[iVar][jVar];
7070  if (iVar == jVar)
7071  LowMach_Precontioner[iVar][iVar] += 1.0;
7072  }
7073  }
7074 
7075 }
7076 
7077 void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, unsigned short iMesh, bool Output) {
7078 
7079  unsigned short iDim, iMarker, jMarker;
7080  unsigned long iVertex, iPoint;
7081  su2double *V_inlet = NULL, *V_outlet = NULL, Pressure, Temperature, Velocity[3], Vn,
7082  Velocity2, Density, Area, SoundSpeed, TotalPressure, Vel_Infty2, RamDrag,
7083  TotalTemperature, VelocityJet,
7084  Vel_Infty, MaxPressure, MinPressure, MFR, InfVel2;
7085  unsigned short iMarker_Inlet, iMarker_Outlet, nMarker_Inlet, nMarker_Outlet;
7086  string Inlet_TagBound, Outlet_TagBound;
7087  su2double DeltaPress = 0.0, DeltaTemp = 0.0, TotalPressRatio = 0.0, TotalTempRatio = 0.0, StaticPressRatio = 0.0, StaticTempRatio = 0.0,
7088  NetThrust = 0.0, GrossThrust = 0.0, Power = 0.0, MassFlow = 0.0, Mach = 0.0, Force = 0.0;
7089  bool ReverseFlow, Engine = false, Pair = true;
7090 
7091  su2double Gas_Constant = config->GetGas_ConstantND();
7092  su2double Cp = Gas_Constant*Gamma / (Gamma-1.0);
7093  su2double Alpha = config->GetAoA()*PI_NUMBER/180.0;
7094  su2double Beta = config->GetAoS()*PI_NUMBER/180.0;
7095  bool write_heads = ((((config->GetExtIter() % (config->GetWrt_Con_Freq()*40)) == 0) && (config->GetExtIter()!= 0))
7096  || (config->GetExtIter() == 1));
7097  bool Evaluate_BC = ((((config->GetExtIter() % (config->GetWrt_Con_Freq()*40)) == 0))
7098  || (config->GetExtIter() == 1) || (config->GetDiscrete_Adjoint()));
7099 
7100  if ((config->GetnMarker_EngineInflow() != 0) || (config->GetnMarker_EngineExhaust() != 0)) Engine = true;
7101  if ((config->GetnMarker_ActDiskInlet() != 0) || (config->GetnMarker_ActDiskOutlet() != 0)) Engine = false;
7102  if ((config->GetnMarker_EngineInflow()) != (config->GetnMarker_EngineExhaust())) Pair = false;
7103 
7104 
7105  if (Engine) { nMarker_Inlet = config->GetnMarker_EngineInflow(); nMarker_Outlet = config->GetnMarker_EngineExhaust(); }
7106  else { nMarker_Inlet = config->GetnMarker_ActDiskInlet(); nMarker_Outlet = config->GetnMarker_ActDiskOutlet(); }
7107 
7108  /*--- Evaluate the MPI for the actuator disk IO ---*/
7109 
7110  if (Evaluate_BC) {
7111 
7112  /*--- Allocate memory ---*/
7113 
7114  su2double *Inlet_MassFlow = new su2double [config->GetnMarker_All()];
7115  su2double *Inlet_ReverseMassFlow = new su2double [config->GetnMarker_All()];
7116  su2double *Inlet_Pressure = new su2double [config->GetnMarker_All()];
7117  su2double *Inlet_Mach = new su2double [config->GetnMarker_All()];
7118  su2double *Inlet_MaxPressure = new su2double [config->GetnMarker_All()];
7119  su2double *Inlet_MinPressure = new su2double [config->GetnMarker_All()];
7120  su2double *Inlet_TotalPressure = new su2double [config->GetnMarker_All()];
7121  su2double *Inlet_Temperature = new su2double [config->GetnMarker_All()];
7122  su2double *Inlet_TotalTemperature = new su2double [config->GetnMarker_All()];
7123  su2double *Inlet_Area = new su2double [config->GetnMarker_All()];
7124  su2double *Inlet_RamDrag = new su2double [config->GetnMarker_All()];
7125  su2double *Inlet_Force = new su2double [config->GetnMarker_All()];
7126  su2double *Inlet_Power = new su2double [config->GetnMarker_All()];
7127  su2double *Inlet_XCG = new su2double [config->GetnMarker_All()];
7128  su2double *Inlet_YCG = new su2double [config->GetnMarker_All()];
7129  su2double *Inlet_ZCG = new su2double [config->GetnMarker_All()];
7130 
7131  su2double *Outlet_MassFlow = new su2double [config->GetnMarker_All()];
7132  su2double *Outlet_Pressure = new su2double [config->GetnMarker_All()];
7133  su2double *Outlet_TotalPressure = new su2double [config->GetnMarker_All()];
7134  su2double *Outlet_Temperature = new su2double [config->GetnMarker_All()];
7135  su2double *Outlet_TotalTemperature = new su2double [config->GetnMarker_All()];
7136  su2double *Outlet_Area = new su2double [config->GetnMarker_All()];
7137  su2double *Outlet_GrossThrust = new su2double [config->GetnMarker_All()];
7138  su2double *Outlet_Force = new su2double [config->GetnMarker_All()];
7139  su2double *Outlet_Power = new su2double [config->GetnMarker_All()];
7140 
7141  /*--- Comute MassFlow, average temp, press, etc. ---*/
7142 
7143  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
7144 
7145  Inlet_MassFlow[iMarker] = 0.0; Inlet_ReverseMassFlow[iMarker] = 0.0; Inlet_MinPressure[iMarker] = 0.0;
7146  Inlet_Pressure[iMarker] = 0.0; Inlet_Mach[iMarker] = 0.0; Inlet_Temperature[iMarker] = 0.0;
7147  Inlet_MinPressure[iMarker] = +1E10; Inlet_MaxPressure[iMarker] = -1E10; Inlet_Power[iMarker] = 0.0;
7148  Inlet_TotalPressure[iMarker] = 0.0; Inlet_TotalTemperature[iMarker] = 0.0;
7149  Inlet_Area[iMarker] = 0.0;
7150  Inlet_RamDrag[iMarker] = 0.0; Inlet_Force[iMarker] = 0.0;
7151  Inlet_XCG[iMarker] = 0.0; Inlet_YCG[iMarker] = 0.0; Inlet_ZCG[iMarker] = 0.0;
7152 
7153  Outlet_MassFlow[iMarker] = 0.0;
7154  Outlet_Pressure[iMarker] = 0.0; Outlet_Temperature[iMarker] = 0.0;
7155  Outlet_TotalPressure[iMarker] = 0.0; Outlet_TotalTemperature[iMarker] = 0.0;
7156  Outlet_Area[iMarker] = 0.0;
7157  Outlet_GrossThrust[iMarker] = 0.0; Outlet_Force[iMarker] = 0.0; Outlet_Power[iMarker] = 0.0;
7158 
7159  MinPressure = +1E10; MaxPressure = -1E10;
7160 
7161  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) ||
7162  (config->GetMarker_All_KindBC(iMarker) == ENGINE_INFLOW)) {
7163 
7164  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
7165 
7166  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
7167 
7168  if (geometry->node[iPoint]->GetDomain()) {
7169 
7170  V_inlet = node[iPoint]->GetPrimitive();
7171 
7172  geometry->vertex[iMarker][iVertex]->GetNormal(Vector);
7173 
7174  Temperature = V_inlet[0];
7175  Pressure = V_inlet[nDim+1];
7176 
7177  Density = V_inlet[nDim+2];
7178  SoundSpeed = sqrt(Gamma*Pressure/Density);
7179 
7180  Velocity2 = 0.0; Area = 0.0; MassFlow = 0.0; Vel_Infty2 =0.0;
7181  for (iDim = 0; iDim < nDim; iDim++) {
7182  Area += Vector[iDim]*Vector[iDim];
7183  Velocity[iDim] = V_inlet[iDim+1];
7184  Velocity2 += Velocity[iDim]*Velocity[iDim];
7185  Vel_Infty2 += GetVelocity_Inf(iDim)*GetVelocity_Inf(iDim);
7186  MassFlow -= Vector[iDim]*Velocity[iDim]*Density;
7187  }
7188 
7189  Vn = 0.0; ReverseFlow = false;
7190  for (iDim = 0; iDim < nDim; iDim++) { Vn -= Velocity[iDim]*Vector[iDim]/Area; }
7191  if (Vn < 0.0) { ReverseFlow = true; }
7192 
7193  Vel_Infty = sqrt (Vel_Infty2);
7194  Area = sqrt (Area);
7195  Mach = sqrt(Velocity2)/SoundSpeed;
7196  TotalPressure = Pressure * pow( 1.0 + Mach * Mach * 0.5 * (Gamma - 1.0), Gamma / (Gamma - 1.0));
7197  TotalTemperature = Temperature * (1.0 + Mach * Mach * 0.5 * (Gamma - 1.0));
7198  MinPressure = min(MinPressure, TotalPressure);
7199  MaxPressure = max(MaxPressure, TotalPressure);
7200 
7201  RamDrag = MassFlow * Vel_Infty;
7202 
7203  Inlet_MassFlow[iMarker] += MassFlow;
7204  Inlet_Pressure[iMarker] += Pressure*MassFlow;
7205  Inlet_Mach[iMarker] += Mach*MassFlow;
7206  Inlet_MinPressure[iMarker] = min (MinPressure, Inlet_MinPressure[iMarker]);
7207  Inlet_MaxPressure[iMarker] = max(MaxPressure, Inlet_MaxPressure[iMarker]);
7208  Inlet_TotalPressure[iMarker] += TotalPressure*MassFlow;
7209  Inlet_Temperature[iMarker] += Temperature*MassFlow;
7210  Inlet_TotalTemperature[iMarker] += TotalTemperature*MassFlow;
7211  Inlet_Area[iMarker] += Area;
7212  Inlet_RamDrag[iMarker] += RamDrag;
7213  Inlet_Power[iMarker] += MassFlow*Cp*TotalTemperature;
7214  if (ReverseFlow) Inlet_ReverseMassFlow[iMarker] += MassFlow;
7215 
7216  su2double Inlet_ForceX = -(Pressure - Pressure_Inf)*Vector[0] + MassFlow*Velocity[0];
7217  su2double Inlet_ForceY = -(Pressure - Pressure_Inf)*Vector[1] + MassFlow*Velocity[1];
7218  su2double Inlet_ForceZ = 0.0;
7219  if (nDim == 3) Inlet_ForceZ = -(Pressure - Pressure_Inf)*Vector[2] + MassFlow*Velocity[2];
7220  Inlet_Force[iMarker] += Inlet_ForceX*cos(Alpha)*cos(Beta) + Inlet_ForceY*sin(Beta) +Inlet_ForceZ*sin(Alpha)*cos(Beta);
7221 
7222  Inlet_XCG[iMarker] += geometry->node[iPoint]->GetCoord(0)*Area;
7223  Inlet_YCG[iMarker] += geometry->node[iPoint]->GetCoord(1)*Area;
7224  if (nDim == 3) Inlet_ZCG[iMarker] += geometry->node[iPoint]->GetCoord(2)*Area;
7225 
7226  }
7227  }
7228 
7229  }
7230 
7231  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET) ||
7232  (config->GetMarker_All_KindBC(iMarker) == ENGINE_EXHAUST)) {
7233 
7234  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
7235 
7236  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
7237 
7238  if (geometry->node[iPoint]->GetDomain()) {
7239 
7240  V_outlet = node[iPoint]->GetPrimitive();
7241 
7242  geometry->vertex[iMarker][iVertex]->GetNormal(Vector);
7243 
7244  Temperature = V_outlet[0];
7245  Pressure = V_outlet[nDim+1];
7246 
7247  Density = V_outlet[nDim+2];
7248  SoundSpeed = sqrt(Gamma*Pressure/Density);
7249 
7250  Velocity2 = 0.0; Area = 0.0; MassFlow = 0.0; Vel_Infty2 = 0.0;
7251  for (iDim = 0; iDim < nDim; iDim++) {
7252  Area += Vector[iDim]*Vector[iDim];
7253  Velocity[iDim] = V_outlet[iDim+1];
7254  Velocity2 += Velocity[iDim]*Velocity[iDim];
7255  Vel_Infty2 += GetVelocity_Inf(iDim)*GetVelocity_Inf(iDim);
7256  MassFlow += Vector[iDim]*Velocity[iDim]*Density;
7257  }
7258 
7259  Vel_Infty = sqrt (Vel_Infty2);
7260  Area = sqrt (Area);
7261  Mach = sqrt(Velocity2)/SoundSpeed;
7262  TotalPressure = Pressure * pow( 1.0 + Mach * Mach * 0.5 * (Gamma - 1.0), Gamma / (Gamma - 1.0));
7263  TotalTemperature = Temperature * (1.0 + Mach * Mach * 0.5 * (Gamma - 1.0));
7264  VelocityJet = sqrt(Velocity2) ;
7265 
7266  GrossThrust = MassFlow * VelocityJet;
7267 
7268  Outlet_MassFlow[iMarker] += MassFlow;
7269  Outlet_Pressure[iMarker] += Pressure*MassFlow;
7270  Outlet_TotalPressure[iMarker] += TotalPressure*MassFlow;
7271  Outlet_Temperature[iMarker] += Temperature*MassFlow;
7272  Outlet_TotalTemperature[iMarker] += TotalTemperature*MassFlow;
7273  Outlet_Area[iMarker] += Area;
7274  Outlet_GrossThrust[iMarker] += GrossThrust;
7275  Outlet_Power[iMarker] += MassFlow*Cp*TotalTemperature;
7276 
7277  su2double Outlet_ForceX = -(Pressure - Pressure_Inf)*Vector[0] -MassFlow*Velocity[0];
7278  su2double Outlet_ForceY = -(Pressure - Pressure_Inf)*Vector[1] -MassFlow*Velocity[1];
7279  su2double Outlet_ForceZ = 0.0;
7280  if (nDim == 3) Outlet_ForceZ = -(Pressure - Pressure_Inf)*Vector[2] -MassFlow*Velocity[2];
7281 
7282  if (nDim == 2) Outlet_Force[iMarker] += Outlet_ForceX*cos(Alpha) + Outlet_ForceY*sin(Alpha);
7283  if (nDim == 3) Outlet_Force[iMarker] += Outlet_ForceX*cos(Alpha)*cos(Beta) + Outlet_ForceY*sin(Beta) + Outlet_ForceZ*sin(Alpha)*cos(Beta);
7284 
7285  }
7286  }
7287 
7288  }
7289 
7290  }
7291 
7292  /*--- Copy to the appropriate structure ---*/
7293 
7294  su2double *Inlet_MassFlow_Local = new su2double [nMarker_Inlet];
7295  su2double *Inlet_ReverseMassFlow_Local = new su2double [nMarker_Inlet];
7296  su2double *Inlet_Temperature_Local = new su2double [nMarker_Inlet];
7297  su2double *Inlet_TotalTemperature_Local = new su2double [nMarker_Inlet];
7298  su2double *Inlet_Pressure_Local = new su2double [nMarker_Inlet];
7299  su2double *Inlet_Mach_Local = new su2double [nMarker_Inlet];
7300  su2double *Inlet_MinPressure_Local = new su2double [nMarker_Inlet];
7301  su2double *Inlet_MaxPressure_Local = new su2double [nMarker_Inlet];
7302  su2double *Inlet_Power_Local = new su2double [nMarker_Inlet];
7303  su2double *Inlet_TotalPressure_Local = new su2double [nMarker_Inlet];
7304  su2double *Inlet_RamDrag_Local = new su2double [nMarker_Inlet];
7305  su2double *Inlet_Force_Local = new su2double [nMarker_Inlet];
7306  su2double *Inlet_Area_Local = new su2double [nMarker_Inlet];
7307  su2double *Inlet_XCG_Local = new su2double [nMarker_Inlet];
7308  su2double *Inlet_YCG_Local = new su2double [nMarker_Inlet];
7309  su2double *Inlet_ZCG_Local = new su2double [nMarker_Inlet];
7310 
7311  su2double *Inlet_MassFlow_Total = new su2double [nMarker_Inlet];
7312  su2double *Inlet_ReverseMassFlow_Total = new su2double [nMarker_Inlet];
7313  su2double *Inlet_Pressure_Total = new su2double [nMarker_Inlet];
7314  su2double *Inlet_Mach_Total = new su2double [nMarker_Inlet];
7315  su2double *Inlet_MinPressure_Total = new su2double [nMarker_Inlet];
7316  su2double *Inlet_MaxPressure_Total = new su2double [nMarker_Inlet];
7317  su2double *Inlet_Power_Total = new su2double [nMarker_Inlet];
7318  su2double *Inlet_TotalPressure_Total = new su2double [nMarker_Inlet];
7319  su2double *Inlet_Temperature_Total = new su2double [nMarker_Inlet];
7320  su2double *Inlet_TotalTemperature_Total = new su2double [nMarker_Inlet];
7321  su2double *Inlet_RamDrag_Total = new su2double [nMarker_Inlet];
7322  su2double *Inlet_Force_Total = new su2double [nMarker_Inlet];
7323  su2double *Inlet_Area_Total = new su2double [nMarker_Inlet];
7324  su2double *Inlet_XCG_Total = new su2double [nMarker_Inlet];
7325  su2double *Inlet_YCG_Total = new su2double [nMarker_Inlet];
7326  su2double *Inlet_ZCG_Total = new su2double [nMarker_Inlet];
7327 
7328  for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet; iMarker_Inlet++) {
7329  Inlet_MassFlow_Local[iMarker_Inlet] = 0.0;
7330  Inlet_ReverseMassFlow_Local[iMarker_Inlet] = 0.0;
7331  Inlet_Pressure_Local[iMarker_Inlet] = 0.0;
7332  Inlet_Mach_Local[iMarker_Inlet] = 0.0;
7333  Inlet_MinPressure_Local[iMarker_Inlet] = 0.0;
7334  Inlet_MaxPressure_Local[iMarker_Inlet] = 0.0;
7335  Inlet_TotalPressure_Local[iMarker_Inlet] = 0.0;
7336  Inlet_Temperature_Local[iMarker_Inlet] = 0.0;
7337  Inlet_TotalTemperature_Local[iMarker_Inlet] = 0.0;
7338  Inlet_RamDrag_Local[iMarker_Inlet] = 0.0;
7339  Inlet_Force_Local[iMarker_Inlet] = 0.0;
7340  Inlet_Power_Local[iMarker_Inlet] = 0.0;
7341  Inlet_Area_Local[iMarker_Inlet] = 0.0;
7342  Inlet_XCG_Local[iMarker_Inlet] = 0.0;
7343  Inlet_YCG_Local[iMarker_Inlet] = 0.0;
7344  Inlet_ZCG_Local[iMarker_Inlet] = 0.0;
7345 
7346  Inlet_MassFlow_Total[iMarker_Inlet] = 0.0;
7347  Inlet_ReverseMassFlow_Total[iMarker_Inlet] = 0.0;
7348  Inlet_Pressure_Total[iMarker_Inlet] = 0.0;
7349  Inlet_Mach_Total[iMarker_Inlet] = 0.0;
7350  Inlet_MinPressure_Total[iMarker_Inlet] = 0.0;
7351  Inlet_MaxPressure_Total[iMarker_Inlet] = 0.0;
7352  Inlet_TotalPressure_Total[iMarker_Inlet] = 0.0;
7353  Inlet_Temperature_Total[iMarker_Inlet] = 0.0;
7354  Inlet_TotalTemperature_Total[iMarker_Inlet] = 0.0;
7355  Inlet_RamDrag_Total[iMarker_Inlet] = 0.0;
7356  Inlet_Force_Total[iMarker_Inlet] = 0.0;
7357  Inlet_Power_Total[iMarker_Inlet] = 0.0;
7358  Inlet_Area_Total[iMarker_Inlet] = 0.0;
7359  Inlet_XCG_Total[iMarker_Inlet] = 0.0;
7360  Inlet_YCG_Total[iMarker_Inlet] = 0.0;
7361  Inlet_ZCG_Total[iMarker_Inlet] = 0.0;
7362  }
7363 
7364  su2double *Outlet_MassFlow_Local = new su2double [nMarker_Outlet];
7365  su2double *Outlet_Pressure_Local = new su2double [nMarker_Outlet];
7366  su2double *Outlet_TotalPressure_Local = new su2double [nMarker_Outlet];
7367  su2double *Outlet_Temperature_Local = new su2double [nMarker_Outlet];
7368  su2double *Outlet_TotalTemperature_Local = new su2double [nMarker_Outlet];
7369  su2double *Outlet_GrossThrust_Local = new su2double [nMarker_Outlet];
7370  su2double *Outlet_Force_Local = new su2double [nMarker_Outlet];
7371  su2double *Outlet_Power_Local = new su2double [nMarker_Outlet];
7372  su2double *Outlet_Area_Local = new su2double [nMarker_Outlet];
7373 
7374  su2double *Outlet_MassFlow_Total = new su2double [nMarker_Outlet];
7375  su2double *Outlet_Pressure_Total = new su2double [nMarker_Outlet];
7376  su2double *Outlet_TotalPressure_Total = new su2double [nMarker_Outlet];
7377  su2double *Outlet_Temperature_Total = new su2double [nMarker_Outlet];
7378  su2double *Outlet_TotalTemperature_Total = new su2double [nMarker_Outlet];
7379  su2double *Outlet_GrossThrust_Total = new su2double [nMarker_Outlet];
7380  su2double *Outlet_Force_Total = new su2double [nMarker_Outlet];
7381  su2double *Outlet_Power_Total = new su2double [nMarker_Outlet];
7382  su2double *Outlet_Area_Total = new su2double [nMarker_Outlet];
7383 
7384  for (iMarker_Outlet = 0; iMarker_Outlet < nMarker_Outlet; iMarker_Outlet++) {
7385  Outlet_MassFlow_Local[iMarker_Outlet] = 0.0;
7386  Outlet_Pressure_Local[iMarker_Outlet] = 0.0;
7387  Outlet_TotalPressure_Local[iMarker_Outlet] = 0.0;
7388  Outlet_Temperature_Local[iMarker_Outlet] = 0.0;
7389  Outlet_TotalTemperature_Local[iMarker_Outlet] = 0.0;
7390  Outlet_GrossThrust_Local[iMarker_Outlet] = 0.0;
7391  Outlet_Force_Local[iMarker_Outlet] = 0.0;
7392  Outlet_Power_Local[iMarker_Outlet] = 0.0;
7393  Outlet_Area_Local[iMarker_Outlet] = 0.0;
7394 
7395  Outlet_MassFlow_Total[iMarker_Outlet] = 0.0;
7396  Outlet_Pressure_Total[iMarker_Outlet] = 0.0;
7397  Outlet_TotalPressure_Total[iMarker_Outlet] = 0.0;
7398  Outlet_Temperature_Total[iMarker_Outlet] = 0.0;
7399  Outlet_TotalTemperature_Total[iMarker_Outlet] = 0.0;
7400  Outlet_GrossThrust_Total[iMarker_Outlet] = 0.0;
7401  Outlet_Force_Total[iMarker_Outlet] = 0.0;
7402  Outlet_Power_Total[iMarker_Outlet] = 0.0;
7403  Outlet_Area_Total[iMarker_Outlet] = 0.0;
7404  }
7405 
7406  /*--- Copy the values to the local array for MPI ---*/
7407 
7408  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
7409 
7410  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || (config->GetMarker_All_KindBC(iMarker) == ENGINE_INFLOW)) {
7411  for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet; iMarker_Inlet++) {
7412 
7413  if (config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) Inlet_TagBound = config->GetMarker_ActDiskInlet_TagBound(iMarker_Inlet);
7414  if (config->GetMarker_All_KindBC(iMarker) == ENGINE_INFLOW) Inlet_TagBound = config->GetMarker_EngineInflow_TagBound(iMarker_Inlet);
7415 
7416  if (config->GetMarker_All_TagBound(iMarker) == Inlet_TagBound) {
7417  Inlet_MassFlow_Local[iMarker_Inlet] += Inlet_MassFlow[iMarker];
7418  Inlet_ReverseMassFlow_Local[iMarker_Inlet] += Inlet_ReverseMassFlow[iMarker];
7419  Inlet_Pressure_Local[iMarker_Inlet] += Inlet_Pressure[iMarker];
7420  Inlet_Mach_Local[iMarker_Inlet] += Inlet_Mach[iMarker];
7421  Inlet_MinPressure_Local[iMarker_Inlet] += Inlet_MinPressure[iMarker];
7422  Inlet_MaxPressure_Local[iMarker_Inlet] += Inlet_MaxPressure[iMarker];
7423  Inlet_TotalPressure_Local[iMarker_Inlet] += Inlet_TotalPressure[iMarker];
7424  Inlet_Temperature_Local[iMarker_Inlet] += Inlet_Temperature[iMarker];
7425  Inlet_TotalTemperature_Local[iMarker_Inlet] += Inlet_TotalTemperature[iMarker];
7426  Inlet_RamDrag_Local[iMarker_Inlet] += Inlet_RamDrag[iMarker];
7427  Inlet_Force_Local[iMarker_Inlet] += Inlet_Force[iMarker];
7428  Inlet_Power_Local[iMarker_Inlet] += Inlet_Power[iMarker];
7429  Inlet_Area_Local[iMarker_Inlet] += Inlet_Area[iMarker];
7430  Inlet_XCG_Local[iMarker_Inlet] += Inlet_XCG[iMarker];
7431  Inlet_YCG_Local[iMarker_Inlet] += Inlet_YCG[iMarker];
7432  if (nDim == 3) Inlet_ZCG_Local[iMarker_Inlet] += Inlet_ZCG[iMarker];
7433  }
7434 
7435  }
7436  }
7437 
7438  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET) || (config->GetMarker_All_KindBC(iMarker) == ENGINE_EXHAUST)) {
7439  for (iMarker_Outlet= 0; iMarker_Outlet < nMarker_Outlet; iMarker_Outlet++) {
7440 
7441  if (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET) Outlet_TagBound = config->GetMarker_ActDiskOutlet_TagBound(iMarker_Outlet);
7442  if (config->GetMarker_All_KindBC(iMarker) == ENGINE_EXHAUST) Outlet_TagBound = config->GetMarker_EngineExhaust_TagBound(iMarker_Outlet);
7443 
7444  if (config->GetMarker_All_TagBound(iMarker) == Outlet_TagBound) {
7445  Outlet_MassFlow_Local[iMarker_Outlet] += Outlet_MassFlow[iMarker];
7446  Outlet_Pressure_Local[iMarker_Outlet] += Outlet_Pressure[iMarker];
7447  Outlet_TotalPressure_Local[iMarker_Outlet] += Outlet_TotalPressure[iMarker];
7448  Outlet_Temperature_Local[iMarker_Outlet] += Outlet_Temperature[iMarker];
7449  Outlet_TotalTemperature_Local[iMarker_Outlet] += Outlet_TotalTemperature[iMarker];
7450  Outlet_GrossThrust_Local[iMarker_Outlet] += Outlet_GrossThrust[iMarker];
7451  Outlet_Force_Local[iMarker_Outlet] += Outlet_Force[iMarker];
7452  Outlet_Power_Local[iMarker_Outlet] += Outlet_Power[iMarker];
7453  Outlet_Area_Local[iMarker_Outlet] += Outlet_Area[iMarker];
7454  }
7455 
7456  }
7457  }
7458 
7459  }
7460 
7461  /*--- Correct the min max values for the MPI ---*/
7462 
7463  bool ActDisk = false;
7464  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
7465  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) ||
7466  (config->GetMarker_All_KindBC(iMarker) == ENGINE_INFLOW)) { ActDisk = true; break; }
7467  }
7468 
7469  if (!ActDisk) {
7470  for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet; iMarker_Inlet++) {
7471  Inlet_MinPressure_Local[iMarker_Inlet] = 1E10;
7472  Inlet_MaxPressure_Local[iMarker_Inlet] = -1E10;
7473  }
7474  }
7475 
7476  /*--- All the ranks to compute the total value ---*/
7477 
7478 #ifdef HAVE_MPI
7479 
7480  SU2_MPI::Allreduce(Inlet_MassFlow_Local, Inlet_MassFlow_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7481  SU2_MPI::Allreduce(Inlet_ReverseMassFlow_Local, Inlet_ReverseMassFlow_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7482  SU2_MPI::Allreduce(Inlet_Pressure_Local, Inlet_Pressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7483  SU2_MPI::Allreduce(Inlet_Mach_Local, Inlet_Mach_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7484  SU2_MPI::Allreduce(Inlet_MinPressure_Local, Inlet_MinPressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
7485  SU2_MPI::Allreduce(Inlet_MaxPressure_Local, Inlet_MaxPressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
7486  SU2_MPI::Allreduce(Inlet_TotalPressure_Local, Inlet_TotalPressure_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7487  SU2_MPI::Allreduce(Inlet_Temperature_Local, Inlet_Temperature_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7488  SU2_MPI::Allreduce(Inlet_TotalTemperature_Local, Inlet_TotalTemperature_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7489  SU2_MPI::Allreduce(Inlet_RamDrag_Local, Inlet_RamDrag_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7490  SU2_MPI::Allreduce(Inlet_Force_Local, Inlet_Force_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7491  SU2_MPI::Allreduce(Inlet_Power_Local, Inlet_Power_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7492  SU2_MPI::Allreduce(Inlet_Area_Local, Inlet_Area_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7493  SU2_MPI::Allreduce(Inlet_XCG_Local, Inlet_XCG_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7494  SU2_MPI::Allreduce(Inlet_YCG_Local, Inlet_YCG_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7495  if (nDim == 3) SU2_MPI::Allreduce(Inlet_ZCG_Local, Inlet_ZCG_Total, nMarker_Inlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7496 
7497  SU2_MPI::Allreduce(Outlet_MassFlow_Local, Outlet_MassFlow_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7498  SU2_MPI::Allreduce(Outlet_Pressure_Local, Outlet_Pressure_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7499  SU2_MPI::Allreduce(Outlet_TotalPressure_Local, Outlet_TotalPressure_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7500  SU2_MPI::Allreduce(Outlet_Temperature_Local, Outlet_Temperature_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7501  SU2_MPI::Allreduce(Outlet_TotalTemperature_Local, Outlet_TotalTemperature_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7502  SU2_MPI::Allreduce(Outlet_GrossThrust_Local, Outlet_GrossThrust_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7503  SU2_MPI::Allreduce(Outlet_Force_Local, Outlet_Force_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7504  SU2_MPI::Allreduce(Outlet_Power_Local, Outlet_Power_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7505  SU2_MPI::Allreduce(Outlet_Area_Local, Outlet_Area_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
7506 
7507 #else
7508 
7509  for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet; iMarker_Inlet++) {
7510  Inlet_MassFlow_Total[iMarker_Inlet] = Inlet_MassFlow_Local[iMarker_Inlet];
7511  Inlet_ReverseMassFlow_Total[iMarker_Inlet] = Inlet_ReverseMassFlow_Local[iMarker_Inlet];
7512  Inlet_Pressure_Total[iMarker_Inlet] = Inlet_Pressure_Local[iMarker_Inlet];
7513  Inlet_Mach_Total[iMarker_Inlet] = Inlet_Mach_Local[iMarker_Inlet];
7514  Inlet_MinPressure_Total[iMarker_Inlet] = Inlet_MinPressure_Local[iMarker_Inlet];
7515  Inlet_MaxPressure_Total[iMarker_Inlet] = Inlet_MaxPressure_Local[iMarker_Inlet];
7516  Inlet_TotalPressure_Total[iMarker_Inlet] = Inlet_TotalPressure_Local[iMarker_Inlet];
7517  Inlet_Temperature_Total[iMarker_Inlet] = Inlet_Temperature_Local[iMarker_Inlet];
7518  Inlet_TotalTemperature_Total[iMarker_Inlet] = Inlet_TotalTemperature_Local[iMarker_Inlet];
7519  Inlet_RamDrag_Total[iMarker_Inlet] = Inlet_RamDrag_Local[iMarker_Inlet];
7520  Inlet_Force_Total[iMarker_Inlet] = Inlet_Force_Local[iMarker_Inlet];
7521  Inlet_Power_Total[iMarker_Inlet] = Inlet_Power_Local[iMarker_Inlet];
7522  Inlet_Area_Total[iMarker_Inlet] = Inlet_Area_Local[iMarker_Inlet];
7523  Inlet_XCG_Total[iMarker_Inlet] = Inlet_XCG_Local[iMarker_Inlet];
7524  Inlet_YCG_Total[iMarker_Inlet] = Inlet_YCG_Local[iMarker_Inlet];
7525  if (nDim == 3) Inlet_ZCG_Total[iMarker_Inlet] = Inlet_ZCG_Local[iMarker_Inlet];
7526  }
7527 
7528  for (iMarker_Outlet = 0; iMarker_Outlet < nMarker_Outlet; iMarker_Outlet++) {
7529  Outlet_MassFlow_Total[iMarker_Outlet] = Outlet_MassFlow_Local[iMarker_Outlet];
7530  Outlet_Pressure_Total[iMarker_Outlet] = Outlet_Pressure_Local[iMarker_Outlet];
7531  Outlet_TotalPressure_Total[iMarker_Outlet] = Outlet_TotalPressure_Local[iMarker_Outlet];
7532  Outlet_Temperature_Total[iMarker_Outlet] = Outlet_Temperature_Local[iMarker_Outlet];
7533  Outlet_TotalTemperature_Total[iMarker_Outlet] = Outlet_TotalTemperature_Local[iMarker_Outlet];
7534  Outlet_GrossThrust_Total[iMarker_Outlet] = Outlet_GrossThrust_Local[iMarker_Outlet];
7535  Outlet_Force_Total[iMarker_Outlet] = Outlet_Force_Local[iMarker_Outlet];
7536  Outlet_Power_Total[iMarker_Outlet] = Outlet_Power_Local[iMarker_Outlet];
7537  Outlet_Area_Total[iMarker_Outlet] = Outlet_Area_Local[iMarker_Outlet];
7538  }
7539 
7540 #endif
7541 
7542  /*--- Compute the value of the average surface temperature and pressure and
7543  set the value in the config structure for future use ---*/
7544 
7545  for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet; iMarker_Inlet++) {
7546  if (Inlet_Area_Total[iMarker_Inlet] != 0.0) {
7547  Inlet_Pressure_Total[iMarker_Inlet] /= Inlet_MassFlow_Total[iMarker_Inlet];
7548  Inlet_Mach_Total[iMarker_Inlet] /= Inlet_MassFlow_Total[iMarker_Inlet];
7549  Inlet_TotalPressure_Total[iMarker_Inlet] /= Inlet_MassFlow_Total[iMarker_Inlet];
7550  Inlet_Temperature_Total[iMarker_Inlet] /= Inlet_MassFlow_Total[iMarker_Inlet];
7551  Inlet_TotalTemperature_Total[iMarker_Inlet] /= Inlet_MassFlow_Total[iMarker_Inlet];
7552  Inlet_XCG_Total[iMarker_Inlet] /= Inlet_Area_Total[iMarker_Inlet];
7553  Inlet_YCG_Total[iMarker_Inlet] /= Inlet_Area_Total[iMarker_Inlet];
7554  if (nDim == 3) Inlet_ZCG_Total[iMarker_Inlet] /= Inlet_Area_Total[iMarker_Inlet];
7555  }
7556  else {
7557  Inlet_Pressure_Total[iMarker_Inlet] = 0.0;
7558  Inlet_Mach_Total[iMarker_Inlet] = 0.0;
7559  Inlet_TotalPressure_Total[iMarker_Inlet] = 0.0;
7560  Inlet_Temperature_Total[iMarker_Inlet] = 0.0;
7561  Inlet_TotalTemperature_Total[iMarker_Inlet] = 0.0;
7562  Inlet_XCG_Total[iMarker_Inlet] = 0.0;
7563  Inlet_YCG_Total[iMarker_Inlet] = 0.0;
7564  if (nDim == 3) Inlet_ZCG_Total[iMarker_Inlet] = 0.0;
7565  }
7566 
7567  if (iMesh == MESH_0) {
7568 
7569  if (Engine) {
7570  config->SetInflow_MassFlow(iMarker_Inlet, Inlet_MassFlow_Total[iMarker_Inlet]);
7571  config->SetInflow_ReverseMassFlow(iMarker_Inlet, Inlet_ReverseMassFlow_Total[iMarker_Inlet]);
7572  config->SetInflow_Pressure(iMarker_Inlet, Inlet_Pressure_Total[iMarker_Inlet]);
7573  config->SetInflow_TotalPressure(iMarker_Inlet, Inlet_TotalPressure_Total[iMarker_Inlet]);
7574  config->SetInflow_Temperature(iMarker_Inlet, Inlet_Temperature_Total[iMarker_Inlet]);
7575  config->SetInflow_TotalTemperature(iMarker_Inlet, Inlet_TotalTemperature_Total[iMarker_Inlet]);
7576  config->SetInflow_RamDrag(iMarker_Inlet, Inlet_RamDrag_Total[iMarker_Inlet]);
7577  config->SetInflow_Force(iMarker_Inlet, Inlet_Force_Total[iMarker_Inlet]);
7578  config->SetInflow_Power(iMarker_Inlet, Inlet_Power_Total[iMarker_Inlet]);
7579  }
7580  else {
7581  config->SetActDiskInlet_MassFlow(iMarker_Inlet, Inlet_MassFlow_Total[iMarker_Inlet]);
7582  config->SetActDiskInlet_ReverseMassFlow(iMarker_Inlet, Inlet_ReverseMassFlow_Total[iMarker_Inlet]);
7583  config->SetActDiskInlet_Pressure(iMarker_Inlet, Inlet_Pressure_Total[iMarker_Inlet]);
7584  config->SetActDiskInlet_TotalPressure(iMarker_Inlet, Inlet_TotalPressure_Total[iMarker_Inlet]);
7585  config->SetActDiskInlet_Temperature(iMarker_Inlet, Inlet_Temperature_Total[iMarker_Inlet]);
7586  config->SetActDiskInlet_TotalTemperature(iMarker_Inlet, Inlet_TotalTemperature_Total[iMarker_Inlet]);
7587  config->SetActDiskInlet_RamDrag(iMarker_Inlet, Inlet_RamDrag_Total[iMarker_Inlet]);
7588  config->SetActDiskInlet_Force(iMarker_Inlet, Inlet_Force_Total[iMarker_Inlet]);
7589  config->SetActDiskInlet_Power(iMarker_Inlet, Inlet_Power_Total[iMarker_Inlet]);
7590  }
7591 
7592  }
7593 
7594  }
7595 
7596  for (iMarker_Outlet = 0; iMarker_Outlet < nMarker_Outlet; iMarker_Outlet++) {
7597  if (Outlet_Area_Total[iMarker_Outlet] != 0.0) {
7598  Outlet_Pressure_Total[iMarker_Outlet] /= Outlet_MassFlow_Total[iMarker_Outlet];
7599  Outlet_TotalPressure_Total[iMarker_Outlet] /= Outlet_MassFlow_Total[iMarker_Outlet];
7600  Outlet_Temperature_Total[iMarker_Outlet] /= Outlet_MassFlow_Total[iMarker_Outlet];
7601  Outlet_TotalTemperature_Total[iMarker_Outlet] /= Outlet_MassFlow_Total[iMarker_Outlet];
7602  }
7603  else {
7604  Outlet_Pressure_Total[iMarker_Outlet] = 0.0;
7605  Outlet_TotalPressure_Total[iMarker_Outlet] = 0.0;
7606  Outlet_Temperature_Total[iMarker_Outlet] = 0.0;
7607  Outlet_TotalTemperature_Total[iMarker_Outlet] = 0.0;
7608  }
7609 
7610  if (iMesh == MESH_0) {
7611 
7612  if (Engine) {
7613  config->SetExhaust_MassFlow(iMarker_Outlet, Outlet_MassFlow_Total[iMarker_Outlet]);
7614  config->SetExhaust_Pressure(iMarker_Outlet, Outlet_Pressure_Total[iMarker_Outlet]);
7615  config->SetExhaust_TotalPressure(iMarker_Outlet, Outlet_TotalPressure_Total[iMarker_Outlet]);
7616  config->SetExhaust_Temperature(iMarker_Outlet, Outlet_Temperature_Total[iMarker_Outlet]);
7617  config->SetExhaust_TotalTemperature(iMarker_Outlet, Outlet_TotalTemperature_Total[iMarker_Outlet]);
7618  config->SetExhaust_GrossThrust(iMarker_Outlet, Outlet_GrossThrust_Total[iMarker_Outlet]);
7619  config->SetExhaust_Force(iMarker_Outlet, Outlet_Force_Total[iMarker_Outlet]);
7620  config->SetExhaust_Power(iMarker_Outlet, Outlet_Power_Total[iMarker_Outlet]);
7621  }
7622  else {
7623  config->SetActDiskOutlet_MassFlow(iMarker_Outlet, Outlet_MassFlow_Total[iMarker_Outlet]);
7624  config->SetActDiskOutlet_Pressure(iMarker_Outlet, Outlet_Pressure_Total[iMarker_Outlet]);
7625  config->SetActDiskOutlet_TotalPressure(iMarker_Outlet, Outlet_TotalPressure_Total[iMarker_Outlet]);
7626  config->SetActDiskOutlet_Temperature(iMarker_Outlet, Outlet_Temperature_Total[iMarker_Outlet]);
7627  config->SetActDiskOutlet_TotalTemperature(iMarker_Outlet, Outlet_TotalTemperature_Total[iMarker_Outlet]);
7628  config->SetActDiskOutlet_GrossThrust(iMarker_Outlet, Outlet_GrossThrust_Total[iMarker_Outlet]);
7629  config->SetActDiskOutlet_Force(iMarker_Outlet, Outlet_Force_Total[iMarker_Outlet]);
7630  config->SetActDiskOutlet_Power(iMarker_Outlet, Outlet_Power_Total[iMarker_Outlet]);
7631  }
7632 
7633  }
7634 
7635  }
7636 
7637 
7638  if (Pair) {
7639 
7640  /*--- Store delta pressure, temperature, thrust, and area ---*/
7641 
7642  for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet; iMarker_Inlet++) {
7643 
7644  if (Engine) {
7645  Inlet_TagBound = config->GetMarker_EngineInflow_TagBound(iMarker_Inlet);
7646  jMarker = config->GetMarker_CfgFile_EngineExhaust(Inlet_TagBound);
7647  Outlet_TagBound = config->GetMarker_CfgFile_TagBound(jMarker);
7648  }
7649  else {
7650  Inlet_TagBound = config->GetMarker_ActDiskInlet_TagBound(iMarker_Inlet);
7651  jMarker = config->GetMarker_CfgFile_ActDiskOutlet(Inlet_TagBound);
7652  Outlet_TagBound = config->GetMarker_CfgFile_TagBound(jMarker);
7653  }
7654 
7655 
7656  su2double DeltaPress = 0.0, DeltaTemp = 0.0, NetThrust = 0.0, GrossThrust = 0.0, TotalPressRatio = 0.0, TotalTempRatio = 0.0, StaticPressRatio = 0.0, StaticTempRatio = 0.0;
7657 
7658  if (Engine) {
7659  DeltaPress = config->GetExhaust_Pressure(Outlet_TagBound) - config->GetInflow_Pressure(Inlet_TagBound);
7660  DeltaTemp = config->GetExhaust_Temperature(Outlet_TagBound) - config->GetInflow_Temperature(Inlet_TagBound);
7661  NetThrust = config->GetExhaust_GrossThrust(Outlet_TagBound) - config->GetInflow_RamDrag(Inlet_TagBound);
7662  GrossThrust = config->GetExhaust_GrossThrust(Outlet_TagBound);
7663  TotalPressRatio = config->GetExhaust_TotalPressure(Outlet_TagBound)/config->GetInflow_TotalPressure(Inlet_TagBound);
7664  TotalTempRatio = config->GetExhaust_TotalTemperature(Outlet_TagBound)/config->GetInflow_TotalTemperature(Inlet_TagBound);
7665  StaticPressRatio = config->GetExhaust_Pressure(Outlet_TagBound)/config->GetInflow_Pressure(Inlet_TagBound);
7666  StaticTempRatio = config->GetExhaust_Temperature(Outlet_TagBound)/config->GetInflow_Temperature(Inlet_TagBound);
7667  Force = config->GetInflow_Force(Inlet_TagBound) + config->GetExhaust_Force(Outlet_TagBound);
7668  Power = config->GetExhaust_Power(Outlet_TagBound) - config->GetInflow_Power(Inlet_TagBound);
7669  }
7670  else {
7671  DeltaPress = config->GetActDiskOutlet_Pressure(Outlet_TagBound) - config->GetActDiskInlet_Pressure(Inlet_TagBound);
7672  DeltaTemp = config->GetActDiskOutlet_Temperature(Outlet_TagBound) - config->GetActDiskInlet_Temperature(Inlet_TagBound);
7673  NetThrust = config->GetActDiskOutlet_GrossThrust(Outlet_TagBound) - config->GetActDiskInlet_RamDrag(Inlet_TagBound);
7674  GrossThrust = config->GetActDiskOutlet_GrossThrust(Outlet_TagBound);
7675  TotalPressRatio = config->GetActDiskOutlet_TotalPressure(Outlet_TagBound)/config->GetActDiskInlet_TotalPressure(Inlet_TagBound);
7676  TotalTempRatio = config->GetActDiskOutlet_TotalTemperature(Outlet_TagBound)/config->GetActDiskInlet_TotalTemperature(Inlet_TagBound);
7677  StaticPressRatio = config->GetActDiskOutlet_Pressure(Outlet_TagBound)/config->GetActDiskInlet_Pressure(Inlet_TagBound);
7678  StaticTempRatio = config->GetActDiskOutlet_Temperature(Outlet_TagBound)/config->GetActDiskInlet_Temperature(Inlet_TagBound);
7679  Force = config->GetActDiskInlet_Force(Inlet_TagBound) + config->GetActDiskOutlet_Force(Outlet_TagBound);
7680  Power = config->GetActDiskOutlet_Power(Outlet_TagBound) - config->GetActDiskInlet_Power(Inlet_TagBound);
7681  MassFlow = config->GetActDiskInlet_MassFlow(Inlet_TagBound);
7682  }
7683 
7684  Mach = Inlet_Mach_Total[iMarker_Inlet];
7685  Area = Inlet_Area_Total[iMarker_Inlet];
7686 
7687  if (Engine) {
7688  config->SetEngine_Mach(iMarker_Inlet, Mach);
7689  config->SetEngine_Force(iMarker_Inlet, Force);
7690  config->SetEngine_Power(iMarker_Inlet, Power);
7691  config->SetEngine_NetThrust(iMarker_Inlet, NetThrust);
7692  config->SetEngine_GrossThrust(iMarker_Inlet, GrossThrust);
7693  config->SetEngine_Area(iMarker_Inlet, Area);
7694  }
7695  else {
7696  config->SetActDisk_DeltaPress(iMarker_Inlet, DeltaPress);
7697  config->SetActDisk_DeltaTemp(iMarker_Inlet, DeltaTemp);
7698  config->SetActDisk_Mach(iMarker_Inlet, Mach);
7699  config->SetActDisk_Force(iMarker_Inlet, Force);
7700  config->SetActDisk_Power(iMarker_Inlet, Power);
7701  config->SetActDisk_MassFlow(iMarker_Inlet, MassFlow);
7702  config->SetActDisk_TotalPressRatio(iMarker_Inlet, TotalPressRatio);
7703  config->SetActDisk_TotalTempRatio(iMarker_Inlet, TotalTempRatio);
7704  config->SetActDisk_StaticPressRatio(iMarker_Inlet, StaticPressRatio);
7705  config->SetActDisk_StaticTempRatio(iMarker_Inlet, StaticTempRatio);
7706  config->SetActDisk_NetThrust(iMarker_Inlet, NetThrust);
7707  config->SetActDisk_GrossThrust(iMarker_Inlet, GrossThrust);
7708  config->SetActDisk_Area(iMarker_Inlet, Area);
7709  }
7710 
7711  }
7712 
7713  /*--- Screen output using the values already stored in the config container ---*/
7714 
7715  if ((rank == MASTER_NODE) && (iMesh == MESH_0) ) {
7716 
7717  cout.precision(5);
7718  cout.setf(ios::fixed, ios::floatfield);
7719 
7720  if (write_heads && Output && !config->GetDiscrete_Adjoint()) {
7721  if (Engine) cout << endl << "---------------------------- Engine properties --------------------------" << endl;
7722  else cout << endl << "------------------------ Actuator Disk properties -----------------------" << endl;
7723  }
7724 
7725  for (iMarker_Inlet = 0; iMarker_Inlet < nMarker_Inlet; iMarker_Inlet++) {
7726 
7727  if (Engine) {
7728  Inlet_TagBound = config->GetMarker_EngineInflow_TagBound(iMarker_Inlet);
7729  jMarker = config->GetMarker_CfgFile_EngineExhaust(Inlet_TagBound);
7730  Outlet_TagBound = config->GetMarker_CfgFile_TagBound(jMarker);
7731  }
7732  else {
7733  Inlet_TagBound = config->GetMarker_ActDiskInlet_TagBound(iMarker_Inlet);
7734  jMarker = config->GetMarker_CfgFile_ActDiskOutlet(Inlet_TagBound);
7735  Outlet_TagBound = config->GetMarker_CfgFile_TagBound(jMarker);
7736  }
7737 
7738 
7739  if (Engine) {
7740  NetThrust = config->GetEngine_NetThrust(iMarker_Inlet);
7741  GrossThrust = config->GetEngine_GrossThrust(iMarker_Inlet);
7742  Power = config->GetEngine_Power(iMarker_Inlet);
7743  Mach = config->GetEngine_Mach(iMarker_Inlet);
7744  Force = config->GetEngine_Force(iMarker_Inlet);
7745  }
7746  else {
7747  DeltaPress = config->GetActDisk_DeltaPress(iMarker_Inlet);
7748  DeltaTemp = config->GetActDisk_DeltaTemp(iMarker_Inlet);
7749  TotalPressRatio = config->GetActDisk_TotalPressRatio(iMarker_Inlet);
7750  TotalTempRatio = config->GetActDisk_TotalTempRatio(iMarker_Inlet);
7751  StaticPressRatio = config->GetActDisk_StaticPressRatio(iMarker_Inlet);
7752  StaticTempRatio = config->GetActDisk_StaticTempRatio(iMarker_Inlet);
7753  NetThrust = config->GetActDisk_NetThrust(iMarker_Inlet);
7754  GrossThrust = config->GetActDisk_GrossThrust(iMarker_Inlet);
7755  Power = config->GetActDisk_Power(iMarker_Inlet);
7756  Mach = config->GetActDisk_Mach(iMarker_Inlet);
7757  Force = config->GetActDisk_Force(iMarker_Inlet);
7758  }
7759 
7760  su2double Mach_Inf = config->GetMach();
7762 
7763  su2double TotalPressure_Inf = Pressure_Inf * pow( 1.0 + Mach_Inf * Mach_Inf * 0.5 * (Gamma - 1.0), Gamma / (Gamma - 1.0));
7764 
7765  su2double MinPressure = Inlet_MinPressure_Total[iMarker_Inlet]/TotalPressure_Inf;
7766  su2double MaxPressure = Inlet_MaxPressure_Total[iMarker_Inlet]/TotalPressure_Inf;
7767  su2double AvePressure = Inlet_TotalPressure_Total[iMarker_Inlet]/TotalPressure_Inf;
7768 
7769  su2double RefDensity = Density_Inf;
7770  su2double RefArea = config->GetRefArea();
7771  su2double RefVel2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim]*Velocity_Inf[iDim];
7772 
7773  su2double Factor = (0.5*RefDensity*RefArea*RefVel2);
7774  su2double Ref = config->GetDensity_Ref() * config->GetVelocity_Ref() * config->GetVelocity_Ref() * 1.0 * 1.0;
7775  su2double DmT = GetTotal_CD() * Factor;
7776 
7777 // su2double ModDmT = 0.0;
7778 // if (nDim == 2) ModDmT = sqrt(GetTotal_CFx()*GetTotal_CFx() +
7779 // GetTotal_CFy()*GetTotal_CFy());
7780 //
7781 // if (nDim == 3) ModDmT = sqrt(GetTotal_CFx()*GetTotal_CFx() +
7782 // GetTotal_CFy()*GetTotal_CFy() +
7783 // GetTotal_CFz()*GetTotal_CFz());
7784 //
7785 // DmTVector[0] = GetTotal_CFx()/ModDmT;
7786 // DmTVector[1] = GetTotal_CFy()/ModDmT;
7787 // if (nDim == 3) DmTVector[2] = GetTotal_CFz()/ModDmT;
7788 
7789  /*--- Set the aero drag ---*/
7790 
7791  su2double Aero_Drag = DmT - Force;
7792  su2double Aero_CD = Aero_Drag / Factor;
7793 
7794  SetTotal_AeroCD(Aero_CD);
7795 
7796  /*--- Set the solid surface drag ---*/
7797 
7798  su2double Solid_Drag = DmT - Force;
7799  su2double Solid_CD = Solid_Drag / Factor;
7800 
7801  SetTotal_SolidCD(Solid_CD);
7802 
7803  /*--- Set the net thrust value---*/
7804 
7805  su2double CT = NetThrust / Factor;
7806 
7807  SetTotal_NetThrust(CT);
7808 
7809  /*--- Set the total power ---*/
7810 
7811  su2double PowerHP = Power * Ref * config->GetVelocity_Ref() / 550.0;
7812 
7813  SetTotal_Power(PowerHP);
7814 
7815  /*--- Set the total ReverseFlow ---*/
7816 
7817  su2double ReverseFlow;
7818  if (Engine) ReverseFlow = fabs(config->GetInflow_ReverseMassFlow(iMarker_Inlet) / config->GetInflow_MassFlow(Inlet_TagBound));
7819  else ReverseFlow = fabs(config->GetActDisk_ReverseMassFlow(iMarker_Inlet) / config->GetActDiskInlet_MassFlow(Inlet_TagBound));
7820 
7821  SetTotal_ReverseFlow(ReverseFlow);
7822 
7823  /*--- Set the total mass flow ratio ---*/
7824 
7825  InfVel2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) InfVel2 += Velocity_Inf[iDim]*Velocity_Inf[iDim];
7826  if (Engine) MFR =fabs(config->GetInflow_MassFlow(Inlet_TagBound)) / (Density_Inf * sqrt(InfVel2) * config->GetHighlite_Area());
7827  else MFR = fabs(config->GetActDiskInlet_MassFlow(Inlet_TagBound)) / (Density_Inf * sqrt(InfVel2) * config->GetHighlite_Area());
7828  SetTotal_MFR(MFR);
7829 
7830  /*--- Evaluate shaft power and adiabatic efficiency (average) ---*/
7831 
7832  su2double Pstatic1, P1, P2, T1, T2;
7833  if (Engine) {
7834  Pstatic1 = config->GetInflow_Pressure(Inlet_TagBound);
7835  P1 = config->GetInflow_TotalPressure(Inlet_TagBound);
7836  P2 = config->GetExhaust_TotalPressure(Outlet_TagBound);
7837  T1 = config->GetInflow_TotalTemperature(Inlet_TagBound);
7838  T2 = config->GetExhaust_TotalTemperature(Outlet_TagBound);
7839  }
7840  else {
7841  Pstatic1 = config->GetActDiskInlet_Pressure(Inlet_TagBound);
7842  P1 = config->GetActDiskInlet_TotalPressure(Inlet_TagBound);
7843  P2 = config->GetActDiskOutlet_TotalPressure(Outlet_TagBound);
7844  T1 = config->GetActDiskInlet_TotalTemperature(Inlet_TagBound);
7845  T2 = config->GetActDiskOutlet_TotalTemperature(Outlet_TagBound);
7846  }
7847 
7848  /*-- Set the propulsive efficiency ---*/
7849 
7850  su2double mu_prop = fabs(DmT)*sqrt(RefVel2)/Power;
7851  SetTotal_Prop_Eff(mu_prop);
7852 
7853  /*-- Set the bypass propulsive efficiency ---*/
7854 
7855  su2double mu_bypass_prop = NetThrust*sqrt(RefVel2)/Power;
7856  SetTotal_ByPassProp_Eff(mu_bypass_prop);
7857 
7858  /*-- Set the fan adiabatic efficiency ---*/
7859 
7860  su2double mu_isentropic = 0.0;
7861  if ((P2/P1) > 0.0) mu_isentropic = (T1/(T2-T1))*(pow((P2/P1),(Gamma-1.0)/Gamma)-1.0);
7862  SetTotal_Adiab_Eff(mu_isentropic);
7863 
7864  /*-- Set the polytropic efficiency ---*/
7865 
7866  su2double poly_coeff = 1.0/(1.0-log(T2/T1)/log(P2/P1));
7867  su2double mu_polytropic = ((Gamma-1.0)/Gamma)/((poly_coeff-1.0)/poly_coeff);
7868  SetTotal_Poly_Eff(mu_polytropic);
7869 
7870  if (write_heads && Output && !config->GetDiscrete_Adjoint()) {
7871 
7872  if (iMarker_Inlet > 0) cout << endl;
7873 
7874  /*--- Geometry defintion ---*/
7875 
7876  if (Engine) cout <<"Engine surfaces: " << Inlet_TagBound << ", " << Outlet_TagBound << "." << endl;
7877  else cout <<"Actuator disk surfaces: " << Inlet_TagBound << ", " << Outlet_TagBound << "." << endl;
7878 
7879  if (nDim == 2) {
7880  if (config->GetSystemMeasurements() == SI)
7881  cout <<"CG (m): (" << Inlet_XCG_Total[iMarker_Inlet] <<", " << Inlet_YCG_Total[iMarker_Inlet] << "). Length (m): " << Inlet_Area_Total[iMarker_Inlet] << "." << endl;
7882  else if (config->GetSystemMeasurements() == US)
7883  cout <<"CG (in): (" << Inlet_XCG_Total[iMarker_Inlet]*12.0 <<", " << Inlet_YCG_Total[iMarker_Inlet]*12.0 << "). Length (in): " << Inlet_Area_Total[iMarker_Inlet]*12.0 << "." << endl;
7884  cout << endl;
7885  }
7886 
7887  if (nDim ==3) {
7888  if (config->GetSystemMeasurements() == SI)
7889  cout <<"CG (m): (" << Inlet_XCG_Total[iMarker_Inlet] <<", " << Inlet_YCG_Total[iMarker_Inlet] <<", " << Inlet_ZCG_Total[iMarker_Inlet] << "). Area (m^2): " << Inlet_Area_Total[iMarker_Inlet] << ". Radius (m): " << sqrt(Inlet_Area_Total[iMarker_Inlet]/PI_NUMBER) << "." << endl;
7890  else if (config->GetSystemMeasurements() == US)
7891  cout <<"CG (in): (" << Inlet_XCG_Total[iMarker_Inlet]*12.0 <<", " << Inlet_YCG_Total[iMarker_Inlet]*12.0 <<", " << Inlet_ZCG_Total[iMarker_Inlet]*12.0 << "). Area (in^2): " << Inlet_Area_Total[iMarker_Inlet]*12.0*12.0 << "." << endl;
7892  cout << endl;
7893  }
7894 
7895 
7896  /*--- Flow field descritption ---*/
7897 
7898  if (config->GetSystemMeasurements() == SI) {
7899  cout << setprecision(2) << "Inlet Ave. P (Pa): " << Pstatic1*config->GetPressure_Ref() << setprecision(3) << ". Inlet Ave. Mach: " << Mach << "." << endl;
7900  cout << setprecision(2) << "Outlet Ave. PT (Pa): " << P2*config->GetPressure_Ref() << ". Outlet Ave. TT (K): " << T2*config->GetTemperature_Ref() << "." << endl;
7901  }
7902  else if (config->GetSystemMeasurements() == US) {
7903  cout << setprecision(2) << "Inlet Ave. P (psf): " << Pstatic1*config->GetPressure_Ref() << setprecision(3) << ". Inlet Ave. Mach: " << Mach << "." << endl;
7904  cout << setprecision(2) << "Outlet Ave. PT (psf): " << P2*config->GetPressure_Ref() << ". Outlet Ave. TT (R): " << T2*config->GetTemperature_Ref() << "." << endl;
7905  }
7906 
7907  cout << "Inlet min. PT/PTinf: " << MinPressure << ". Inlet max. PT/PTinf: " << MaxPressure << ". Inlet Ave. PT/PTinf: " << AvePressure << endl;
7908 
7909  su2double InfVel2, Inlet_MassFlow, Outlet_MassFlow;
7910 
7911  if (Engine) Inlet_MassFlow = fabs(config->GetInflow_MassFlow(Inlet_TagBound)) * config->GetDensity_Ref() * config->GetVelocity_Ref();
7912  else Inlet_MassFlow = fabs(config->GetActDiskInlet_MassFlow(Inlet_TagBound)) * config->GetDensity_Ref() * config->GetVelocity_Ref();
7913 
7914  if (config->GetSystemMeasurements() == SI) { cout << "Inlet mass flow (kg/s): "; cout << setprecision(2) << Inlet_MassFlow; }
7915  else if (config->GetSystemMeasurements() == US) { cout << "Inlet mass flow (lbs/s): "; cout << setprecision(2) << Inlet_MassFlow * 32.174; }
7916 
7917  if (Engine) Outlet_MassFlow = fabs(config->GetExhaust_MassFlow(Outlet_TagBound)) * config->GetDensity_Ref() * config->GetVelocity_Ref();
7918  else Outlet_MassFlow = fabs(config->GetActDiskOutlet_MassFlow(Outlet_TagBound)) * config->GetDensity_Ref() * config->GetVelocity_Ref();
7919 
7920  // if (config->GetSystemMeasurements() == SI) { cout << ". Outlet mass flow (kg/s): "; cout << setprecision(2) << Outlet_MassFlow; }
7921  // else if (config->GetSystemMeasurements() == US) { cout << ". Outlet mass flow (lbs/s): "; cout << setprecision(2) << Outlet_MassFlow * 32.174; }
7922 
7923  if (Inlet_MassFlow > Outlet_MassFlow) cout << ". I/O diff.: " << setprecision(2) << 100.0*fabs(1.0-(Outlet_MassFlow/Inlet_MassFlow)) << "%";
7924  else cout << ". I/O diff.: " << setprecision(2) << -100.0*fabs(1.0-(Inlet_MassFlow/Outlet_MassFlow)) << "%";
7925 
7926  InfVel2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) InfVel2 += Velocity_Inf[iDim]*Velocity_Inf[iDim];
7927  cout << setprecision(2) << ". MFR: " << MFR << "." << endl;
7928 
7929  if (!Engine) {
7930 
7931  cout << setprecision(3) << "PT in/out ratio: " << TotalPressRatio << ". TT in/out ratio: " << TotalTempRatio << "." << endl;
7932 
7933  if (config->GetActDisk_Jump() == VARIABLES_JUMP) {
7934  if (config->GetSystemMeasurements() == SI) cout << setprecision(3) << "P in/out jump (Pa): ";
7935  else if (config->GetSystemMeasurements() == US) cout << setprecision(3) << "P in/out jump (psf): ";
7936  cout << setprecision(3) << DeltaPress * config->GetPressure_Ref();
7937  if (config->GetSystemMeasurements() == SI) cout << setprecision(3) << ". T in/out jump (K): ";
7938  else if (config->GetSystemMeasurements() == US) cout << setprecision(3) << ". T in/out jump (R): ";
7939  cout << setprecision(3) << DeltaTemp * config->GetTemperature_Ref() <<"."<< endl;
7940  }
7941  else if (config->GetActDisk_Jump() == RATIO) {
7942  cout << setprecision(3) << "P in/out ratio: ";
7943  cout << setprecision(3) << StaticPressRatio;
7944  cout << setprecision(3) <<". T in/out ratio: ";
7945  cout << setprecision(3) << StaticTempRatio <<"."<< endl;
7946  }
7947  }
7948 
7949  cout << setprecision(1) << "\nProp. eff. (D-T.V/Shaft P): " << 100*mu_prop << "%. By-pass prop. eff. (NetT.V/Shaft P): " << 100*mu_bypass_prop << "%." << endl;
7950  cout << setprecision(1) << "Fan adiabatic eff.: " << 100*mu_isentropic << "%. Fan poly. eff.: " << 100*mu_polytropic << "%. Poly coeff. (n): " << setprecision(4) << poly_coeff << "." << endl;
7951 
7952  cout << endl;
7953 
7954 
7955  /*--- Forces descritption ---*/
7956 
7957  if (config->GetSystemMeasurements() == SI) cout << setprecision(1) << "Ram Drag (N): ";
7958  else if (config->GetSystemMeasurements() == US) cout << setprecision(1) << "Ram Drag (lbf): ";
7959  cout << (GrossThrust-NetThrust) * Ref;
7960 
7961  if (config->GetSystemMeasurements() == SI) cout << setprecision(1) << ". Gross Thrust (N): ";
7962  else if (config->GetSystemMeasurements() == US) cout << setprecision(1) << ". Gross Thrust (lbf): ";
7963  cout << -GrossThrust * Ref << "." << endl;
7964 
7965  if (config->GetSystemMeasurements() == SI) cout << setprecision(1) << "Open surfaces Thurst (N): ";
7966  else if (config->GetSystemMeasurements() == US) cout << setprecision(1) << "Open surfaces Thrust (lbf): ";
7967  cout<< setprecision(1) << Force * Ref << ". Open surfaces CT: " << setprecision(5) << -Force / Factor << "." << endl;
7968 
7969  if (config->GetSystemMeasurements() == SI) cout << "Solid surfaces Drag (N): ";
7970  else if (config->GetSystemMeasurements() == US) cout << "Solid surfaces Drag (lbf): ";
7971  cout << setprecision(1) << Solid_Drag * Ref << ". Solid surfaces CD: " << setprecision(5) << Solid_CD << "." << endl;
7972 
7973  if (config->GetSystemMeasurements() == SI) cout << setprecision(1) <<"Net Thrust (N): ";
7974  else if (config->GetSystemMeasurements() == US) cout << setprecision(1) << "Net Thrust (lbf): ";
7975  cout << setprecision(5) << -NetThrust * Ref << ". Net CT: " << CT;
7976 
7977  if (config->GetSystemMeasurements() == SI) {
7978  cout << ". Power (W): ";
7979  cout << setprecision(1) << Power * Ref * config->GetVelocity_Ref() << "." << endl;
7980  }
7981  else if (config->GetSystemMeasurements() == US) {
7982  cout << ". Power (HP): ";
7983  cout << setprecision(1) << Power * Ref * config->GetVelocity_Ref() / 550.0 << "." << endl;
7984  }
7985 
7986  }
7987 
7988  }
7989 
7990  if (write_heads && Output && !config->GetDiscrete_Adjoint()) cout << "-------------------------------------------------------------------------" << endl << endl;
7991 
7992  }
7993 
7994  }
7995 
7996 
7997  delete [] Outlet_MassFlow_Local;
7998  delete [] Outlet_Temperature_Local;
7999  delete [] Outlet_TotalTemperature_Local;
8000  delete [] Outlet_Pressure_Local;
8001  delete [] Outlet_TotalPressure_Local;
8002  delete [] Outlet_Area_Local;
8003  delete [] Outlet_GrossThrust_Local;
8004  delete [] Outlet_Force_Local;
8005  delete [] Outlet_Power_Local;
8006 
8007  delete [] Outlet_MassFlow_Total;
8008  delete [] Outlet_Temperature_Total;
8009  delete [] Outlet_TotalTemperature_Total;
8010  delete [] Outlet_Pressure_Total;
8011  delete [] Outlet_TotalPressure_Total;
8012  delete [] Outlet_Area_Total;
8013  delete [] Outlet_GrossThrust_Total;
8014  delete [] Outlet_Force_Total;
8015  delete [] Outlet_Power_Total;
8016 
8017  delete [] Inlet_MassFlow_Local;
8018  delete [] Inlet_ReverseMassFlow_Local;
8019  delete [] Inlet_Temperature_Local;
8020  delete [] Inlet_TotalTemperature_Local;
8021  delete [] Inlet_Pressure_Local;
8022  delete [] Inlet_Mach_Local;
8023  delete [] Inlet_MinPressure_Local;
8024  delete [] Inlet_MaxPressure_Local;
8025  delete [] Inlet_TotalPressure_Local;
8026  delete [] Inlet_Area_Local;
8027  delete [] Inlet_RamDrag_Local;
8028  delete [] Inlet_Force_Local;
8029  delete [] Inlet_Power_Local;
8030  delete [] Inlet_XCG_Local;
8031  delete [] Inlet_YCG_Local;
8032  delete [] Inlet_ZCG_Local;
8033 
8034  delete [] Inlet_MassFlow_Total;
8035  delete [] Inlet_ReverseMassFlow_Total;
8036  delete [] Inlet_Temperature_Total;
8037  delete [] Inlet_TotalTemperature_Total;
8038  delete [] Inlet_Pressure_Total;
8039  delete [] Inlet_Mach_Total;
8040  delete [] Inlet_MinPressure_Total;
8041  delete [] Inlet_MaxPressure_Total;
8042  delete [] Inlet_TotalPressure_Total;
8043  delete [] Inlet_Area_Total;
8044  delete [] Inlet_RamDrag_Total;
8045  delete [] Inlet_Force_Total;
8046  delete [] Inlet_Power_Total;
8047  delete [] Inlet_XCG_Total;
8048  delete [] Inlet_YCG_Total;
8049  delete [] Inlet_ZCG_Total;
8050 
8051  delete [] Inlet_MassFlow;
8052  delete [] Inlet_Mach;
8053  delete [] Inlet_MinPressure;
8054  delete [] Inlet_MaxPressure;
8055  delete [] Inlet_ReverseMassFlow;
8056  delete [] Inlet_Pressure;
8057  delete [] Inlet_TotalPressure;
8058  delete [] Inlet_Temperature;
8059  delete [] Inlet_TotalTemperature;
8060  delete [] Inlet_Area;
8061  delete [] Inlet_RamDrag;
8062  delete [] Inlet_Force;
8063  delete [] Inlet_Power;
8064  delete [] Inlet_XCG;
8065  delete [] Inlet_YCG;
8066  delete [] Inlet_ZCG;
8067 
8068  delete [] Outlet_MassFlow;
8069  delete [] Outlet_Pressure;
8070  delete [] Outlet_TotalPressure;
8071  delete [] Outlet_Temperature;
8072  delete [] Outlet_TotalTemperature;
8073  delete [] Outlet_Area;
8074  delete [] Outlet_GrossThrust;
8075  delete [] Outlet_Force;
8076  delete [] Outlet_Power;
8077 
8078  }
8079 
8080 }
8081 
8082 void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_container,
8083  CConfig *config, unsigned short iMesh, bool Output) {
8084 
8085  su2double Massflow = 0.0 , Target_Massflow = 0.0, DragMinusThrust = 0.0 , Target_DragMinusThrust = 0.0, Target_NetThrust = 0.0, BCThrust = 0.0, BCThrust_inc = 0.0;
8086  unsigned short iDim, iMarker;
8087  unsigned long iVertex, iPoint;
8088  su2double *V_inlet = NULL, Pressure,
8089  Density, T0_Ti, ATerm, BTerm, LHS, RHS, RHS_PDelta, RHS_MDelta, F, DF_DLa, CTerm_, DTerm_,
8090  ETerm, La, La_old, TotalArea, To_Ti, DeltaT, Po_Pi, DeltaP, Area, Velocity_Normal,
8091  SoundSpeed2, Force_Normal,
8092  RefDensity, RefArea, RefVel2, Factor, Ref;
8093  unsigned short iter;
8094  string Marker_Tag;
8095  su2double Target_Force, Force, Target_Power, Power, NetThrust, BCThrust_old, Initial_BCThrust;
8096  bool ActDisk_Info;
8097  su2double MyBCThrust, BCThrust_Init;
8098 
8099  su2double dNetThrust_dBCThrust = config->GetdNetThrust_dBCThrust();
8100  unsigned short Kind_ActDisk = config->GetKind_ActDisk();
8101  bool ratio = (config->GetActDisk_Jump() == RATIO);
8102  unsigned long Update_BCThrust = config->GetUpdate_BCThrust();
8103  unsigned long Iter_Fixed_NetThrust = config->GetIter_Fixed_NetThrust();
8104  unsigned long ExtIter = config->GetExtIter();
8105  bool Update_BCThrust_Bool = false;
8106  bool restart = (config->GetRestart() || config->GetRestart_Flow());
8107  su2double Fan_Poly_Eff = config->GetFan_Poly_Eff();
8108  su2double PolyCoeff = 1.0/(1.0-((Gamma-1.0)/Gamma)/Fan_Poly_Eff);
8109 
8110  RefDensity = Density_Inf;
8111  RefArea = config->GetRefArea();
8112  RefVel2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim]*Velocity_Inf[iDim];
8113 
8114  Factor = (0.5*RefDensity*RefArea*RefVel2);
8115  Ref = config->GetDensity_Ref() * config->GetVelocity_Ref() * config->GetVelocity_Ref() * 1.0 * 1.0;
8116 
8117  /*--- Delta P and delta T are inputs ---*/
8118 
8119  if (Kind_ActDisk == VARIABLES_JUMP) {
8120  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
8121 
8122  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) ||
8123  (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) {
8124 
8125  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
8126 
8127  if (ratio) {
8128  if (config->GetMach() < 0.5) {
8129  DeltaP = config->GetActDisk_PressJump(Marker_Tag, 0);
8130  DeltaT = config->GetActDisk_TempJump(Marker_Tag, 0);
8131  }
8132  else {
8133  DeltaP = config->GetActDisk_PressJump(Marker_Tag, 1);
8134  DeltaT = config->GetActDisk_TempJump(Marker_Tag, 1);
8135  }
8136  }
8137  else {
8138  if (config->GetMach() < 0.5) {
8139  DeltaP = max(0.0, config->GetActDisk_PressJump(Marker_Tag, 0) / config->GetPressure_Ref());
8140  DeltaT = max(0.0, config->GetActDisk_TempJump(Marker_Tag, 0) / config->GetTemperature_Ref());
8141  }
8142  else {
8143  DeltaP = max(0.0, config->GetActDisk_PressJump(Marker_Tag, 1) / config->GetPressure_Ref());
8144  DeltaT = max(0.0, config->GetActDisk_TempJump(Marker_Tag, 1) / config->GetTemperature_Ref());
8145  }
8146  }
8147 
8148  /*--- Set the Delta P, Delta T values at each discrete point (uniform distribution) ---*/
8149 
8150  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
8151  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
8152  SetActDisk_DeltaP(iMarker, iVertex, DeltaP);
8153  SetActDisk_DeltaT(iMarker, iVertex, DeltaT);
8154  }
8155 
8156  }
8157  }
8158  }
8159 
8160  /*--- Iteration using BCThrust ---*/
8161 
8162  else {
8163 
8164  if (ExtIter == 0) BCThrust_Counter = 0;
8165 
8166  /*--- Only the fine mesh level should check the convergence criteria ---*/
8167 
8168  if ((iMesh == MESH_0) && Output) {
8169 
8170  /*--- Initialize the update flag to false ---*/
8171 
8172  Update_BCThrust_Bool = false;
8173 
8174  /*--- Reevaluate BCThrust at a fix number of iterations ---*/
8175 
8176  if ((ExtIter % Iter_Fixed_NetThrust == 0) && (ExtIter != 0)) {
8177  BCThrust_Counter++;
8178  if ((BCThrust_Counter != 0) &&
8179  (BCThrust_Counter != 1) &&
8180  (BCThrust_Counter != Update_BCThrust) &&
8181  (BCThrust_Counter != Update_BCThrust + 2) &&
8182  (BCThrust_Counter != Update_BCThrust + 4) ) Update_BCThrust_Bool = true;
8183  else Update_BCThrust_Bool = false;
8184  }
8185 
8186  /*--- Store the update boolean for use on other mesh levels in the MG ---*/
8187 
8188  config->SetUpdate_BCThrust_Bool(Update_BCThrust_Bool);
8189 
8190  }
8191 
8192  else {
8193  Update_BCThrust_Bool = config->GetUpdate_BCThrust_Bool();
8194  }
8195 
8196 
8197  /*--- If it is the first iteration, set the BCThrust to a meaning full target value,
8198  * this can be done at an initialization level, for the time being it is OK here ---*/
8199 
8200  if (ExtIter == 0) {
8201  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
8202  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) ||
8203  (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) {
8204  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
8205 
8206  if (Kind_ActDisk == NET_THRUST) {
8207  if (restart)
8208  Initial_BCThrust = config->GetInitial_BCThrust() / Ref;
8209  else {
8210  if (config->GetMach() < 0.5) Initial_BCThrust = fabs( config->GetActDisk_PressJump(Marker_Tag, 0) / Ref);
8211  else Initial_BCThrust = fabs( config->GetActDisk_PressJump(Marker_Tag, 1) / Ref);
8212  }
8213  config->SetActDisk_BCThrust(Marker_Tag, Initial_BCThrust);
8214  config->SetActDisk_BCThrust_Old(Marker_Tag, Initial_BCThrust);
8215  }
8216 
8217  if (Kind_ActDisk == BC_THRUST) {
8218  if (restart)
8219  Initial_BCThrust = config->GetInitial_BCThrust() / Ref;
8220  else {
8221  if (config->GetMach() < 0.5) Initial_BCThrust = fabs( config->GetActDisk_PressJump(Marker_Tag, 0) / Ref);
8222  else Initial_BCThrust = fabs( config->GetActDisk_PressJump(Marker_Tag, 1) / Ref);
8223  }
8224  config->SetActDisk_BCThrust(Marker_Tag, Initial_BCThrust);
8225  config->SetActDisk_BCThrust_Old(Marker_Tag, Initial_BCThrust);
8226  }
8227 
8228  if (Kind_ActDisk == POWER) {
8229  Initial_BCThrust = config->GetInitial_BCThrust() / Ref;
8230  config->SetActDisk_BCThrust(Marker_Tag, Initial_BCThrust);
8231  config->SetActDisk_BCThrust_Old(Marker_Tag, Initial_BCThrust);
8232  }
8233 
8234  if (Kind_ActDisk == DRAG_MINUS_THRUST) {
8235  Initial_BCThrust = config->GetInitial_BCThrust() / Ref;
8236  config->SetActDisk_BCThrust(Marker_Tag, Initial_BCThrust);
8237  config->SetActDisk_BCThrust_Old(Marker_Tag, Initial_BCThrust);
8238  }
8239 
8240  if (Kind_ActDisk == MASSFLOW) {
8241  Initial_BCThrust = config->GetInitial_BCThrust() / Ref;
8242  config->SetActDisk_BCThrust(Marker_Tag, Initial_BCThrust);
8243  config->SetActDisk_BCThrust_Old(Marker_Tag, Initial_BCThrust);
8244  }
8245 
8246  }
8247  }
8248  }
8249 
8250  /*--- Typical iteration to set the value of BC Thrust at each actuator disk ---*/
8251 
8252  if (Update_BCThrust_Bool && Output) {
8253 
8254  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
8255 
8256  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) ||
8257  (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) {
8258 
8259  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
8260 
8261  if (Kind_ActDisk == NET_THRUST) {
8262 
8263  if (config->GetMach() < 0.5) Target_NetThrust = fabs( config->GetActDisk_PressJump(Marker_Tag, 0) / Ref);
8264  else Target_NetThrust = fabs( config->GetActDisk_PressJump(Marker_Tag, 1) / Ref);
8265  NetThrust = config->GetActDisk_NetThrust(Marker_Tag);
8266  BCThrust_old = config->GetActDisk_BCThrust_Old(Marker_Tag);
8267  BCThrust_inc = (1.0/dNetThrust_dBCThrust)*(Target_NetThrust - NetThrust);
8268 
8269  if (iMesh == MESH_0) BCThrust = max(0.0,(BCThrust_old + BCThrust_inc));
8270  else BCThrust = config->GetActDisk_BCThrust(Marker_Tag);
8271 
8272  if (iMesh == MESH_0) {
8273  config->SetActDisk_BCThrust(Marker_Tag, BCThrust);
8274  BCThrust_Init = BCThrust*Ref;
8275  config->SetInitial_BCThrust(BCThrust_Init);
8276  }
8277 
8278  }
8279 
8280  if (Kind_ActDisk == BC_THRUST) {
8281 
8282  if (config->GetMach() < 0.5) Target_Force = fabs( config->GetActDisk_PressJump(Marker_Tag, 0) / Ref);
8283  else Target_Force = fabs( config->GetActDisk_PressJump(Marker_Tag, 1) / Ref);
8284  Force = -config->GetActDisk_Force(Marker_Tag);
8285  BCThrust_old = config->GetActDisk_BCThrust_Old(Marker_Tag);
8286  BCThrust_inc = (1.0/dNetThrust_dBCThrust)*(Target_Force - Force);
8287 
8288  if (iMesh == MESH_0) BCThrust = max(0.0,(BCThrust_old + BCThrust_inc));
8289  else BCThrust = config->GetActDisk_BCThrust(Marker_Tag);
8290 
8291  if (iMesh == MESH_0) {
8292  config->SetActDisk_BCThrust(Marker_Tag, BCThrust);
8293  BCThrust_Init = BCThrust*Ref;
8294  config->SetInitial_BCThrust(BCThrust_Init);
8295  }
8296 
8297  }
8298 
8299  if (Kind_ActDisk == POWER) {
8300 
8301  if (config->GetMach() < 0.5) Target_Power = fabs( config->GetActDisk_PressJump(Marker_Tag, 0) / (Ref * config->GetVelocity_Ref() / 550.0));
8302  else Target_Power = fabs( config->GetActDisk_PressJump(Marker_Tag, 1) / (Ref * config->GetVelocity_Ref() / 550.0));
8303  Power = config->GetActDisk_Power(Marker_Tag);
8304  BCThrust_old = config->GetActDisk_BCThrust_Old(Marker_Tag);
8305  BCThrust_inc = (1.0/dNetThrust_dBCThrust)*(Target_Power - Power);
8306 
8307  if (iMesh == MESH_0) BCThrust = max(0.0,(BCThrust_old + BCThrust_inc));
8308  else BCThrust = config->GetActDisk_BCThrust(Marker_Tag);
8309 
8310  if (iMesh == MESH_0) {
8311  config->SetActDisk_BCThrust(Marker_Tag, BCThrust);
8312  BCThrust_Init = BCThrust*Ref;
8313  config->SetInitial_BCThrust(BCThrust_Init);
8314  }
8315 
8316  }
8317 
8318  if (Kind_ActDisk == DRAG_MINUS_THRUST) {
8319 
8320  if (config->GetMach() < 0.5) Target_DragMinusThrust = -fabs(config->GetActDisk_PressJump(Marker_Tag, 0)) * Factor;
8321  else Target_DragMinusThrust = -fabs(config->GetActDisk_PressJump(Marker_Tag, 1)) * Factor;
8322  DragMinusThrust = GetTotal_CD() * Factor;
8323  BCThrust_old = config->GetActDisk_BCThrust_Old(Marker_Tag);
8324  BCThrust_inc = -(1.0/dNetThrust_dBCThrust)*(Target_DragMinusThrust - DragMinusThrust);
8325 
8326  if (iMesh == MESH_0) BCThrust = max(0.0,(BCThrust_old + BCThrust_inc));
8327  else BCThrust = config->GetActDisk_BCThrust(Marker_Tag);
8328 
8329  if (iMesh == MESH_0) {
8330  config->SetActDisk_BCThrust(Marker_Tag, BCThrust);
8331  BCThrust_Init = BCThrust*Ref;
8332  config->SetInitial_BCThrust(BCThrust_Init);
8333  }
8334 
8335  }
8336 
8337  if (Kind_ActDisk == MASSFLOW) {
8338 
8339  if (config->GetMach() < 0.5) {
8340  Target_Massflow = fabs(config->GetActDisk_PressJump(Marker_Tag, 0) / (config->GetDensity_Ref() * config->GetVelocity_Ref()));
8341  if (config->GetSystemMeasurements() == US) Target_Massflow /= 32.174;
8342  }
8343  else {
8344  Target_Massflow = fabs(config->GetActDisk_PressJump(Marker_Tag, 1) / (config->GetDensity_Ref() * config->GetVelocity_Ref()));
8345  if (config->GetSystemMeasurements() == US) Target_Massflow /= 32.174;
8346  }
8347 
8348  Massflow = config->GetActDisk_MassFlow(Marker_Tag);
8349  BCThrust_old = config->GetActDisk_BCThrust_Old(Marker_Tag);
8350  BCThrust_inc = (1.0/dNetThrust_dBCThrust)*(Target_Massflow - Massflow);
8351  if (iMesh == MESH_0) BCThrust = max(0.0,(BCThrust_old + BCThrust_inc));
8352  else BCThrust = config->GetActDisk_BCThrust(Marker_Tag);
8353  if (iMesh == MESH_0) {
8354  config->SetActDisk_BCThrust(Marker_Tag, BCThrust);
8355  BCThrust_Init = BCThrust*Ref;
8356  config->SetInitial_BCThrust(BCThrust_Init);
8357  }
8358 
8359  }
8360 
8361  }
8362 
8363  }
8364 
8365  /*--- After a complete update of BC_Thrust
8366  update the value of BC Thrust (old) for future iterations ---*/
8367 
8368  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
8369  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) ||
8370  (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) {
8371  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
8372  if ((Kind_ActDisk == NET_THRUST) || (Kind_ActDisk == BC_THRUST) ||
8373  (Kind_ActDisk == POWER) || (Kind_ActDisk == DRAG_MINUS_THRUST) ||
8374  (Kind_ActDisk == MASSFLOW)) {
8375  BCThrust = config->GetActDisk_BCThrust(Marker_Tag);
8376  config->SetActDisk_BCThrust_Old(Marker_Tag, BCThrust);
8377  }
8378  }
8379  }
8380 
8381  }
8382 
8383  /*--- Evaluate the pressure jump at each node using the total thrust ---*/
8384 
8385  if ((Update_BCThrust_Bool && Output) || (ExtIter == 0)) {
8386 
8387  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
8388 
8389  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) ||
8390  (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) {
8391 
8392  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
8393  RefDensity = Density_Inf;
8394  RefArea = config->GetRefArea();
8395  RefVel2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim]*Velocity_Inf[iDim];
8396 
8397  Factor = (0.5*RefDensity*RefArea*RefVel2);
8398  Ref = config->GetDensity_Ref() * config->GetVelocity_Ref() * config->GetVelocity_Ref() * 1.0 * 1.0;
8399  BCThrust = config->GetActDisk_BCThrust(Marker_Tag);
8400 
8401  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
8402 
8403  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
8404 
8405  if (geometry->node[iPoint]->GetDomain()) {
8406 
8407  geometry->vertex[iMarker][iVertex]->GetNormal(Vector);
8408 
8409  if (config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) {
8410  for (iDim = 0; iDim < nDim; iDim++) { Vector[iDim] = -Vector[iDim]; }
8411  }
8412 
8413  Area = 0.0;
8414  for (iDim = 0; iDim < nDim; iDim++) { Area += Vector[iDim]*Vector[iDim]; }
8415  Area = sqrt (Area);
8416 
8417  /*--- Use the inlet state to compute the Pressure and Temperature jumps ---*/
8418 
8419  if (config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET)
8420  V_inlet = node[iPoint]->GetPrimitive();
8421  if (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)
8422  V_inlet = GetDonorPrimVar(iMarker, iVertex);
8423 
8424  Density = V_inlet[nDim+2];
8425  Pressure = V_inlet[nDim+1];
8426  SoundSpeed2 = Pressure*Gamma/Density;
8427  TotalArea = config->GetActDisk_Area(Marker_Tag);
8428  Force_Normal = Area*(BCThrust/TotalArea);
8429 
8430 
8431  Velocity_Normal = 0.0;
8432  for (iDim = 0; iDim < nDim; iDim++) {
8433  Velocity_Normal += V_inlet[iDim+1]*Vector[iDim]/Area;
8434  }
8435 
8436 
8437  if (Velocity_Normal > EPS) {
8438 
8439  /*--- Ratio of the total temperature to the temperature at the inflow ---*/
8440 
8441  T0_Ti = 1.0 + ((Gamma-1.0)/SoundSpeed2)*(0.5*Velocity_Normal*Velocity_Normal + Force_Normal/(Density*Area));
8442 
8443 
8444  ATerm = 2.0*T0_Ti/(Gamma+1.0);
8445  BTerm = 0.5*(Gamma+1.0)/(Gamma-1.0);
8446  LHS = fabs(Velocity_Normal)/(sqrt(SoundSpeed2)*pow(ATerm,BTerm));
8447 
8448  CTerm_ = (PolyCoeff-1.0)/(PolyCoeff+1.0);
8449  DTerm_ = 1.0/(PolyCoeff-1.0);
8450 
8451  La = EPS; La_old = EPS;
8452 
8453  for (iter = 0; iter < 100; iter++) {
8454 
8455  ETerm = ((1.0-CTerm_*La*La)/(1.0-CTerm_+EPS));
8456 
8457  RHS = La*pow(ETerm, DTerm_);
8458 
8459  ETerm = ((1.0-CTerm_*(La+1E-6)*(La+1E-6))/(1.0-CTerm_+EPS));
8460  RHS_PDelta = (La+1E-6)*pow(ETerm, DTerm_);
8461 
8462  ETerm = ((1.0-CTerm_*(La-1E-6)*(La-1E-6))/(1.0-CTerm_+EPS));
8463  RHS_MDelta = (La-1E-6)*pow(ETerm, DTerm_);
8464 
8465  /*--- Objective function and finitte differences derivative ---*/
8466 
8467  F = RHS - LHS;
8468  DF_DLa = (RHS_PDelta - RHS_MDelta)/2E-6;
8469 
8470  /*--- Newton's step ---*/
8471 
8472  La_old = La;
8473  La = La_old - 0.75*(F/DF_DLa);
8474 
8475  if (fabs(F) < 1E-10) break;
8476 
8477  }
8478 
8479  if (iter == 99) cout << "The laval number evaluation is not converging." << endl;
8480 
8481  /*--- Laval is bounded ---*/
8482 
8483  La = min(La, sqrt(6.0)); La = max(La, 0.0);
8484 
8485  To_Ti = max(1.0, T0_Ti*(1.0-CTerm_*La*La));
8486  SetActDisk_DeltaT(iMarker, iVertex, To_Ti);
8487 
8488  Po_Pi = max(1.0, pow(To_Ti, PolyCoeff*DTerm_));
8489  SetActDisk_DeltaP(iMarker, iVertex, Po_Pi);
8490 
8491  }
8492  else {
8493  SetActDisk_DeltaT(iMarker, iVertex, 1.0);
8494  SetActDisk_DeltaP(iMarker, iVertex, 1.0);
8495  }
8496 
8497  }
8498 
8499  }
8500  }
8501 
8502  }
8503  }
8504  }
8505 
8506  /*--- Broadcast some information to the master node ---*/
8507 
8508  ActDisk_Info = false;
8509  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
8510  if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) ||
8511  (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) {
8512  ActDisk_Info = true;
8513  }
8514  }
8515  if (!ActDisk_Info) config->SetInitial_BCThrust(0.0);
8516 
8517  MyBCThrust = config->GetInitial_BCThrust();
8518 #ifdef HAVE_MPI
8519  SU2_MPI::Allreduce(&MyBCThrust, &BCThrust, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
8520 #else
8521  BCThrust = MyBCThrust;
8522 #endif
8523  config->SetInitial_BCThrust(BCThrust);
8524 
8525 }
8526 
8527 void CEulerSolver::SetFarfield_AoA(CGeometry *geometry, CSolver **solver_container,
8528  CConfig *config, unsigned short iMesh, bool Output) {
8529 
8530  su2double Target_CL = 0.0, AoA = 0.0, Vel_Infty[3], AoA_inc = 0.0, Vel_Infty_Mag, Old_AoA,
8531  dCL_dAlpha_, dCD_dCL_, dCMx_dCL_, dCMy_dCL_, dCMz_dCL_;
8532  unsigned long Wrt_Con_Freq;
8533  unsigned short iDim;
8534 
8535  unsigned long Iter_Fixed_CL = config->GetIter_Fixed_CL();
8536  unsigned long Update_Alpha = config->GetUpdate_Alpha();
8537 
8538  unsigned long ExtIter = config->GetExtIter();
8539  bool write_heads = ((ExtIter % Iter_Fixed_CL == 0) && (ExtIter != 0));
8540  su2double Beta = config->GetAoS()*PI_NUMBER/180.0;
8541  su2double dCL_dAlpha = config->GetdCL_dAlpha()*180.0/PI_NUMBER;
8542  bool Update_AoA = false;
8543 
8544  if (ExtIter == 0) AoA_Counter = 0;
8545 
8546  /*--- Only the fine mesh level should check the convergence criteria ---*/
8547 
8548  if ((iMesh == MESH_0) && Output) {
8549 
8550  /*--- Initialize the update flag to false ---*/
8551 
8552  Update_AoA = false;
8553 
8554  /*--- Reevaluate Angle of Attack at a fixed number of iterations ---*/
8555 
8556  if ((ExtIter % Iter_Fixed_CL == 0) && (ExtIter != 0)) {
8557  AoA_Counter++;
8558  if ((AoA_Counter <= Update_Alpha)) Update_AoA = true;
8559  else Update_AoA = false;
8560  }
8561 
8562  /*--- Store the update boolean for use on other mesh levels in the MG ---*/
8563 
8564  config->SetUpdate_AoA(Update_AoA);
8565 
8566  }
8567 
8568  else {
8569  Update_AoA = config->GetUpdate_AoA();
8570  }
8571 
8572  if (Update_AoA && Output) {
8573 
8574  /*--- Retrieve the specified target CL value. ---*/
8575 
8576  Target_CL = config->GetTarget_CL();
8577 
8578  /*--- Retrieve the old AoA (radians) ---*/
8579 
8580  AoA_old = config->GetAoA()*PI_NUMBER/180.0;
8581 
8582  /*--- Estimate the increment in AoA based on dCL_dAlpha (radians) ---*/
8583 
8584  AoA_inc = (1.0/dCL_dAlpha)*(Target_CL - Total_CL);
8585 
8586  /*--- Compute a new value for AoA on the fine mesh only (radians)---*/
8587 
8588  if (iMesh == MESH_0) AoA = AoA_old + AoA_inc;
8589  else { AoA = config->GetAoA()*PI_NUMBER/180.0; }
8590 
8591  /*--- Only the fine mesh stores the updated values for AoA in config ---*/
8592 
8593  if (iMesh == MESH_0) {
8594  config->SetAoA(AoA*180.0/PI_NUMBER);
8595  }
8596 
8597  /*--- Update the freestream velocity vector at the farfield ---*/
8598 
8599  for (iDim = 0; iDim < nDim; iDim++)
8600  Vel_Infty[iDim] = GetVelocity_Inf(iDim);
8601 
8602  /*--- Compute the magnitude of the free stream velocity ---*/
8603 
8604  Vel_Infty_Mag = 0;
8605  for (iDim = 0; iDim < nDim; iDim++)
8606  Vel_Infty_Mag += Vel_Infty[iDim]*Vel_Infty[iDim];
8607  Vel_Infty_Mag = sqrt(Vel_Infty_Mag);
8608 
8609  /*--- Compute the new freestream velocity with the updated AoA ---*/
8610 
8611  if (nDim == 2) {
8612  Vel_Infty[0] = cos(AoA)*Vel_Infty_Mag;
8613  Vel_Infty[1] = sin(AoA)*Vel_Infty_Mag;
8614  }
8615  if (nDim == 3) {
8616  Vel_Infty[0] = cos(AoA)*cos(Beta)*Vel_Infty_Mag;
8617  Vel_Infty[1] = sin(Beta)*Vel_Infty_Mag;
8618  Vel_Infty[2] = sin(AoA)*cos(Beta)*Vel_Infty_Mag;
8619  }
8620 
8621  /*--- Store the new freestream velocity vector for the next iteration ---*/
8622 
8623  for (iDim = 0; iDim < nDim; iDim++) {
8624  Velocity_Inf[iDim] = Vel_Infty[iDim];
8625  }
8626 
8627  /*--- Only the fine mesh stores the updated values for velocity in config ---*/
8628 
8629  if (iMesh == MESH_0) {
8630  for (iDim = 0; iDim < nDim; iDim++)
8631  config->SetVelocity_FreeStreamND(Vel_Infty[iDim], iDim);
8632  }
8633 
8634  /*--- Output some information to the console with the headers ---*/
8635 
8636  if ((rank == MASTER_NODE) && (iMesh == MESH_0) && write_heads && !config->GetDiscrete_Adjoint()) {
8637  Old_AoA = config->GetAoA() - AoA_inc*(180.0/PI_NUMBER);
8638 
8639  cout.precision(7);
8640  cout.setf(ios::fixed, ios::floatfield);
8641  cout << endl << "----------------------------- Fixed CL Mode -----------------------------" << endl;
8642  cout << "CL: " << Total_CL;
8643  cout << " (target: " << config->GetTarget_CL() <<")." << endl;
8644  cout.precision(4);
8645  cout << "Previous AoA: " << Old_AoA << " deg";
8646  cout << ", new AoA: " << config->GetAoA() << " deg." << endl;
8647  cout << "-------------------------------------------------------------------------" << endl << endl;
8648  }
8649 
8650  }
8651 
8652  unsigned long Iter_dCL_dAlpha = config->GetIter_dCL_dAlpha();
8653 
8654  if ((config->GetnExtIter()-Iter_dCL_dAlpha == ExtIter) && Output) {
8655 
8656  AoA_old = config->GetAoA();
8657 
8658  if (config->GetnExtIter()-Iter_dCL_dAlpha == ExtIter) {
8659  Wrt_Con_Freq = SU2_TYPE::Int(su2double(config->GetIter_dCL_dAlpha())/10.0);
8660  config->SetWrt_Con_Freq(Wrt_Con_Freq);
8666  AoA_inc = 0.001;
8667  AoA_FD_Change = true;
8668  }
8669 
8670  if ((rank == MASTER_NODE) && (iMesh == MESH_0)) {
8671 
8672  if (config->GetnExtIter()-Iter_dCL_dAlpha == ExtIter) {
8673  cout << endl << "----------------------------- Fixed CL Mode -----------------------------" << endl;
8674  cout << " Change AoA by +0.001 deg to evaluate gradient." << endl;
8675  cout << "-------------------------------------------------------------------------" << endl << endl;
8676  }
8677 
8678  }
8679 
8680  /*--- Compute a new value for AoA on the fine mesh only (radians)---*/
8681 
8682  if (iMesh == MESH_0) AoA = AoA_old + AoA_inc;
8683  else { AoA = config->GetAoA(); }
8684 
8685  /*--- Only the fine mesh stores the updated values for AoA in config ---*/
8686 
8687  if (iMesh == MESH_0) { config->SetAoA(AoA); }
8688 
8689  /*--- Update the freestream velocity vector at the farfield ---*/
8690 
8691  for (iDim = 0; iDim < nDim; iDim++)
8692  Vel_Infty[iDim] = GetVelocity_Inf(iDim);
8693 
8694  /*--- Compute the magnitude of the free stream velocity ---*/
8695 
8696  Vel_Infty_Mag = 0.0;
8697  for (iDim = 0; iDim < nDim; iDim++)
8698  Vel_Infty_Mag += Vel_Infty[iDim]*Vel_Infty[iDim];
8699  Vel_Infty_Mag = sqrt(Vel_Infty_Mag);
8700 
8701  /*--- Compute the new freestream velocity with the updated AoA ---*/
8702 
8703  if (nDim == 2) {
8704  Vel_Infty[0] = cos(AoA*PI_NUMBER/180.0)*Vel_Infty_Mag;
8705  Vel_Infty[1] = sin(AoA*PI_NUMBER/180.0)*Vel_Infty_Mag;
8706  }
8707  if (nDim == 3) {
8708  Vel_Infty[0] = cos(AoA*PI_NUMBER/180.0)*cos(Beta)*Vel_Infty_Mag;
8709  Vel_Infty[1] = sin(Beta)*Vel_Infty_Mag;
8710  Vel_Infty[2] = sin(AoA*PI_NUMBER/180.0)*cos(Beta)*Vel_Infty_Mag;
8711  }
8712 
8713  /*--- Store the new freestream velocity vector for the next iteration ---*/
8714 
8715  for (iDim = 0; iDim < nDim; iDim++) {
8716  Velocity_Inf[iDim] = Vel_Infty[iDim];
8717  }
8718 
8719  /*--- Only the fine mesh stores the updated values for velocity in config ---*/
8720 
8721  if (iMesh == MESH_0) {
8722  for (iDim = 0; iDim < nDim; iDim++)
8723  config->SetVelocity_FreeStreamND(Vel_Infty[iDim], iDim);
8724  }
8725 
8726  }
8727 
8728  if (AoA_FD_Change && (config->GetnExtIter()-1 == ExtIter) && Output && (iMesh == MESH_0) && !config->GetDiscrete_Adjoint()) {
8729 
8730  /*--- Update angle of attack ---*/
8731 
8732  AoA_old = config->GetAoA();
8733  AoA = AoA_old - 0.001;
8734  config->SetAoA(AoA);
8735 
8736  /*--- Use finite differences to compute ---*/
8737 
8738  dCL_dAlpha_ = (Total_CL-Total_CL_Prev)/0.001;
8743 
8744  /*--- Set the value of the dOF/dCL in the config file ---*/
8745 
8746  config->SetdCD_dCL(dCD_dCL_);
8747  config->SetdCMx_dCL(dCMx_dCL_);
8748  config->SetdCMy_dCL(dCMy_dCL_);
8749  config->SetdCMz_dCL(dCMz_dCL_);
8750 
8751  config->SetdCL_dAlpha(dCL_dAlpha_);
8752 
8753  if (rank == MASTER_NODE) {
8754  cout << endl << "----------------------------- Fixed CL Mode -----------------------------" << endl;
8755  cout << "Approx. Delta CL / Delta AoA: " << dCL_dAlpha_ << " (1/deg)." << endl;
8756  cout << "Approx. Delta CD / Delta CL: " << dCD_dCL_ << ". " << endl;
8757  if (nDim == 3 ) {
8758  cout << "Approx. Delta CMx / Delta CL: " << dCMx_dCL_ << ". " << endl;
8759  cout << "Approx. Delta CMy / Delta CL: " << dCMy_dCL_ << ". " << endl;
8760  }
8761  cout << "Approx. Delta CMz / Delta CL: " << dCMz_dCL_ << ". " << endl;
8762  cout << "-------------------------------------------------------------------------" << endl << endl;
8763  }
8764 
8765  }
8766 
8767 }
8768 
8770  unsigned short iMarker,
8771  unsigned long iVertex) {
8772 
8773  /*--- Alias positions within inlet file for readability ---*/
8774 
8775  unsigned short T_position = nDim;
8776  unsigned short P_position = nDim+1;
8777  unsigned short FlowDir_position = nDim+2;
8778 
8779  /*--- Check that the norm of the flow unit vector is actually 1 ---*/
8780 
8781  su2double norm = 0.0;
8782  for (unsigned short iDim = 0; iDim < nDim; iDim++) {
8783  norm += pow(val_inlet[FlowDir_position + iDim], 2);
8784  }
8785  norm = sqrt(norm);
8786 
8787  /*--- The tolerance here needs to be loose. When adding a very
8788  * small number (1e-10 or smaller) to a number close to 1.0, floating
8789  * point roundoff errors can occur. ---*/
8790 
8791  if (abs(norm - 1.0) > 1e-6) {
8792  ostringstream error_msg;
8793  error_msg << "ERROR: Found these values in columns ";
8794  error_msg << FlowDir_position << " - ";
8795  error_msg << FlowDir_position + nDim - 1 << endl;
8796  error_msg << std::scientific;
8797  error_msg << " [" << val_inlet[FlowDir_position];
8798  error_msg << ", " << val_inlet[FlowDir_position + 1];
8799  if (nDim == 3) error_msg << ", " << val_inlet[FlowDir_position + 2];
8800  error_msg << "]" << endl;
8801  error_msg << " These values should be components of a unit vector for direction," << endl;
8802  error_msg << " but their magnitude is: " << norm << endl;
8803  SU2_MPI::Error(error_msg.str(), CURRENT_FUNCTION);
8804  }
8805 
8806  /*--- Store the values in our inlet data structures. ---*/
8807 
8808  Inlet_Ttotal[iMarker][iVertex] = val_inlet[T_position];
8809  Inlet_Ptotal[iMarker][iVertex] = val_inlet[P_position];
8810  for (unsigned short iDim = 0; iDim < nDim; iDim++) {
8811  Inlet_FlowDir[iMarker][iVertex][iDim] = val_inlet[FlowDir_position + iDim];
8812  }
8813 
8814 }
8815 
8817  unsigned long val_inlet_point,
8818  unsigned short val_kind_marker,
8819  string val_marker,
8820  CGeometry *geometry,
8821  CConfig *config) {
8822 
8823  /*--- Local variables ---*/
8824 
8825  unsigned short iMarker, iDim;
8826  unsigned long iPoint, iVertex;
8827  su2double Area = 0.0;
8828  su2double Normal[3] = {0.0,0.0,0.0};
8829 
8830  /*--- Alias positions within inlet file for readability ---*/
8831 
8832  unsigned short T_position = nDim;
8833  unsigned short P_position = nDim+1;
8834  unsigned short FlowDir_position = nDim+2;
8835 
8836  if (val_kind_marker == INLET_FLOW) {
8837 
8838  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
8839  if ((config->GetMarker_All_KindBC(iMarker) == INLET_FLOW) &&
8840  (config->GetMarker_All_TagBound(iMarker) == val_marker)) {
8841 
8842  for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++){
8843 
8844  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
8845 
8846  if (iPoint == val_inlet_point) {
8847 
8848  /*-- Compute boundary face area for this vertex. ---*/
8849 
8850  geometry->vertex[iMarker][iVertex]->GetNormal(Normal);
8851  Area = 0.0;
8852  for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
8853  Area = sqrt(Area);
8854 
8855  /*--- Access and store the inlet variables for this vertex. ---*/
8856 
8857  val_inlet[T_position] = Inlet_Ttotal[iMarker][iVertex];
8858  val_inlet[P_position] = Inlet_Ptotal[iMarker][iVertex];
8859  for (iDim = 0; iDim < nDim; iDim++) {
8860  val_inlet[FlowDir_position + iDim] = Inlet_FlowDir[iMarker][iVertex][iDim];
8861  }
8862 
8863  /*--- Exit once we find the point. ---*/
8864 
8865  return Area;
8866 
8867  }
8868  }
8869  }
8870  }
8871  }
8872 
8873  /*--- If we don't find a match, then the child point is not on the
8874  current inlet boundary marker. Return zero area so this point does
8875  not contribute to the restriction operator and continue. ---*/
8876 
8877  return Area;
8878 
8879 }
8880 
8881 void CEulerSolver::SetUniformInlet(CConfig* config, unsigned short iMarker) {
8882 
8883  if (config->GetMarker_All_KindBC(iMarker) == INLET_FLOW) {
8884 
8885  string Marker_Tag = config->GetMarker_All_TagBound(iMarker);
8886  su2double p_total = config->GetInlet_Ptotal(Marker_Tag);
8887  su2double t_total = config->GetInlet_Ttotal(Marker_Tag);
8888  su2double* flow_dir = config->GetInlet_FlowDir(Marker_Tag);
8889 
8890  for (unsigned long iVertex=0; iVertex < nVertex[iMarker]; iVertex++){
8891  Inlet_Ttotal[iMarker][iVertex] = t_total;
8892  Inlet_Ptotal[iMarker][iVertex] = p_total;
8893  for (unsigned short iDim = 0; iDim < nDim; iDim++)
8894  Inlet_FlowDir[iMarker][iVertex][iDim] = flow_dir[iDim];
8895  }
8896 
8897  } else {
8898 
8899  /*--- For now, non-inlets just get set to zero. In the future, we
8900  can do more customization for other boundary types here. ---*/
8901 
8902  for (unsigned long iVertex=0; iVertex < nVertex[iMarker]; iVertex++){
8903  Inlet_Ttotal[iMarker][iVertex] = 0.0;
8904  Inlet_Ptotal[iMarker][iVertex] = 0.0;
8905  for (unsigned short iDim = 0; iDim < nDim; iDim++)
8906  Inlet_FlowDir[iMarker][iVertex][iDim] = 0.0;
8907  }
8908  }
8909 
8910 }
8911 
8913 
8914  unsigned short nMGlevel, iMarker;
8915 
8916  // TODO: Update the fluid boundary conditions for MG
8917  nMGlevel = config->GetnMGLevels();
8918  if (nMGlevel > 1) {
8919  for (iMarker=0; iMarker < nMarker; iMarker++) {
8920  bool isCustomizable = config->GetMarker_All_PyCustom(iMarker);
8921  bool isInlet = (config->GetMarker_All_KindBC(iMarker) == INLET_FLOW);
8922  if (isCustomizable && isInlet)
8923  SU2_MPI::Error("Custom inlet BCs are not currently compatible with multigrid.", CURRENT_FUNCTION);
8924  }
8925  }
8926 }
8927 
8929 
8930  unsigned short iMarker_Monitoring, Kind_ObjFunc;
8931  su2double Weight_ObjFunc;
8932 
8933  Total_ComboObj = 0.0;
8934 
8935  /*--- Loop over all monitored markers, add to the 'combo' objective ---*/
8936 
8937  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
8938 
8939  Weight_ObjFunc = config->GetWeight_ObjFunc(iMarker_Monitoring);
8940  Kind_ObjFunc = config->GetKind_ObjFunc(iMarker_Monitoring);
8941 
8942  switch(Kind_ObjFunc) {
8943  case DRAG_COEFFICIENT:
8944  Total_ComboObj+=Weight_ObjFunc*(Surface_CD[iMarker_Monitoring]);
8945  if (config->GetFixed_CL_Mode()) Total_ComboObj -= Weight_ObjFunc*config->GetdCD_dCL()*(Surface_CL[iMarker_Monitoring]);
8946  if (config->GetFixed_CM_Mode()) Total_ComboObj -= Weight_ObjFunc*config->GetdCD_dCMy()*(Surface_CMy[iMarker_Monitoring]);
8947  if (config->GetTranspiration_Objective()) Total_ComboObj += Weight_ObjFunc*Surface_Cmu[iMarker_Monitoring];
8948  break;
8949  case LIFT_COEFFICIENT:
8950  Total_ComboObj+=Weight_ObjFunc*(Surface_CL[iMarker_Monitoring]);
8951  break;
8952  case SIDEFORCE_COEFFICIENT:
8953  Total_ComboObj+=Weight_ObjFunc*(Surface_CSF[iMarker_Monitoring]);
8954  break;
8955  case EFFICIENCY:
8956  Total_ComboObj+=Weight_ObjFunc*(Surface_CEff[iMarker_Monitoring]);
8957  break;
8958  case MOMENT_X_COEFFICIENT:
8959  Total_ComboObj+=Weight_ObjFunc*(Surface_CMx[iMarker_Monitoring]);
8960  if (config->GetFixed_CL_Mode()) Total_ComboObj -= Weight_ObjFunc*config->GetdCMx_dCL()*(Surface_CL[iMarker_Monitoring]);
8961  break;
8962  case MOMENT_Y_COEFFICIENT:
8963  Total_ComboObj+=Weight_ObjFunc*(Surface_CMy[iMarker_Monitoring]);
8964  if (config->GetFixed_CL_Mode()) Total_ComboObj -= Weight_ObjFunc*config->GetdCMy_dCL()*(Surface_CL[iMarker_Monitoring]);
8965  break;
8966  case MOMENT_Z_COEFFICIENT:
8967  Total_ComboObj+=Weight_ObjFunc*(Surface_CMz[iMarker_Monitoring]);
8968  if (config->GetFixed_CL_Mode()) Total_ComboObj -= Weight_ObjFunc*config->GetdCMz_dCL()*(Surface_CL[iMarker_Monitoring]);
8969  break;
8970  case FORCE_X_COEFFICIENT:
8971  Total_ComboObj+=Weight_ObjFunc*Surface_CFx[iMarker_Monitoring];
8972  break;
8973  case FORCE_Y_COEFFICIENT:
8974  Total_ComboObj+=Weight_ObjFunc*Surface_CFy[iMarker_Monitoring];
8975  break;
8976  case FORCE_Z_COEFFICIENT:
8977  Total_ComboObj+=Weight_ObjFunc*Surface_CFz[iMarker_Monitoring];
8978  break;
8979  case TOTAL_HEATFLUX:
8980  Total_ComboObj+=Weight_ObjFunc*Surface_HF_Visc[iMarker_Monitoring];
8981  break;
8982  case MAXIMUM_HEATFLUX:
8983  Total_ComboObj+=Weight_ObjFunc*Surface_MaxHF_Visc[iMarker_Monitoring];
8984  break;
8985  case BLOWING_COEFFICIENT:
8986  Total_ComboObj+=Weight_ObjFunc*Surface_Cmu[iMarker_Monitoring];
8987  break;
8988 
8989  default:
8990  break;
8991  }
8992  }
8993 
8994  /*--- The following are not per-surface, and so to avoid that they are
8995  double-counted when multiple surfaces are specified, they have been
8996  placed outside of the loop above. In addition, multi-objective mode is
8997  also disabled for these objective functions (error thrown at start). ---*/
8998 
8999  Weight_ObjFunc = config->GetWeight_ObjFunc(0);
9000  Kind_ObjFunc = config->GetKind_ObjFunc(0);
9001 
9002  switch(Kind_ObjFunc) {
9003  case EQUIVALENT_AREA:
9004  Total_ComboObj+=Weight_ObjFunc*Total_CEquivArea;
9005  break;
9006  case NEARFIELD_PRESSURE:
9007  Total_ComboObj+=Weight_ObjFunc*Total_CNearFieldOF;
9008  break;
9010  Total_ComboObj+=Weight_ObjFunc*Total_CpDiff;
9011  break;
9013  Total_ComboObj+=Weight_ObjFunc*Total_HeatFluxDiff;
9014  break;
9015  case THRUST_COEFFICIENT:
9016  Total_ComboObj+=Weight_ObjFunc*Total_CT;
9017  break;
9018  case TORQUE_COEFFICIENT:
9019  Total_ComboObj+=Weight_ObjFunc*Total_CQ;
9020  break;
9021  case FIGURE_OF_MERIT:
9022  Total_ComboObj+=Weight_ObjFunc*Total_CMerit;
9023  break;
9025  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_TotalPressure(0);
9026  break;
9028  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_Pressure(0);
9029  break;
9030  case SURFACE_MASSFLOW:
9031  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_MassFlow(0);
9032  break;
9033  case SURFACE_MACH:
9034  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_Mach(0);
9035  break;
9036  case SURFACE_UNIFORMITY:
9037  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_Uniformity(0);
9038  break;
9039  case SURFACE_SECONDARY:
9040  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_SecondaryStrength(0);
9041  break;
9043  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_MomentumDistortion(0);
9044  break;
9046  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_SecondOverUniform(0);
9047  break;
9048  case CUSTOM_OBJFUNC:
9049  Total_ComboObj+=Weight_ObjFunc*Total_Custom_ObjFunc;
9050  break;
9051  default:
9052  break;
9053  }
9054 
9055 // if(config->GetTranspiration_Objective()){
9056 // for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
9057 // Total_ComboObj+=Surface_Cmu[iMarker_Monitoring];
9058 // }
9059 // }
9060 
9061 }
9062 
9063 void CEulerSolver::BC_Euler_Wall(CGeometry *geometry, CSolver **solver_container,
9064  CNumerics *numerics, CConfig *config, unsigned short val_marker) {
9065 
9066  unsigned short iDim, iVar, jVar, kVar, jDim;
9067  unsigned long iPoint, iVertex;
9068  su2double *Normal = NULL, *GridVel = NULL, Area, UnitNormal[3], *NormalArea,
9069  ProjGridVel = 0.0, turb_ke;
9070  su2double Density_b, StaticEnergy_b, Enthalpy_b, *Velocity_b, Kappa_b, Chi_b, Energy_b, VelMagnitude2_b, Pressure_b;
9071  su2double Density_i, *Velocity_i, ProjVelocity_i = 0.0, Energy_i, VelMagnitude2_i;
9072  su2double **Jacobian_b, **DubDu;
9073 
9074  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
9075  bool grid_movement = config->GetGrid_Movement();
9076  bool tkeNeeded = (((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS)) &&
9077  (config->GetKind_Turb_Model() == SST));
9078 
9079  Normal = new su2double[nDim];
9080  NormalArea = new su2double[nDim];
9081  Velocity_b = new su2double[nDim];
9082  Velocity_i = new su2double[nDim];
9083  Jacobian_b = new su2double*[nVar];
9084  DubDu = new su2double*[nVar];
9085  for (iVar = 0; iVar < nVar; iVar++) {
9086  Jacobian_b[iVar] = new su2double[nVar];
9087  DubDu[iVar] = new su2double[nVar];
9088  }
9089 
9090  /*--- Loop over all the vertices on this boundary marker ---*/
9091 
9092  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
9093  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
9094 
9095  /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
9096 
9097  if (geometry->node[iPoint]->GetDomain()) {
9098 
9099  /*--- Normal vector for this vertex (negative for outward convention) ---*/
9100 
9101  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
9102 
9103  Area = 0.0;
9104  for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
9105  Area = sqrt (Area);
9106 
9107  for (iDim = 0; iDim < nDim; iDim++) {
9108  NormalArea[iDim] = -Normal[iDim];
9109  UnitNormal[iDim] = -Normal[iDim]/Area;
9110  }
9111 
9112  /*--- Get the state i ---*/
9113 
9114  VelMagnitude2_i = 0.0; ProjVelocity_i = 0.0;
9115  for (iDim = 0; iDim < nDim; iDim++) {
9116  Velocity_i[iDim] = node[iPoint]->GetVelocity(iDim);
9117  ProjVelocity_i += Velocity_i[iDim]*UnitNormal[iDim];
9118  VelMagnitude2_i += Velocity_i[iDim]*Velocity_i[iDim];
9119  }
9120  Density_i = node[iPoint]->GetDensity();
9121  Energy_i = node[iPoint]->GetEnergy();
9122 
9123  /*--- Compute the boundary state b ---*/
9124 
9125  for (iDim = 0; iDim < nDim; iDim++)
9126  Velocity_b[iDim] = Velocity_i[iDim] - ProjVelocity_i * UnitNormal[iDim]; //Force the velocity to be tangential to the surface.
9127 
9128  if (grid_movement) {
9129  GridVel = geometry->node[iPoint]->GetGridVel();
9130  ProjGridVel = 0.0;
9131  for (iDim = 0; iDim < nDim; iDim++) ProjGridVel += GridVel[iDim]*UnitNormal[iDim];
9132  for (iDim = 0; iDim < nDim; iDim++) Velocity_b[iDim] += GridVel[iDim] - ProjGridVel * UnitNormal[iDim];
9133  }
9134 
9135  VelMagnitude2_b = 0.0;
9136  for (iDim = 0; iDim < nDim; iDim++)
9137  VelMagnitude2_b += Velocity_b[iDim] * Velocity_b[iDim];
9138 
9139  /*--- Compute the residual ---*/
9140 
9141  turb_ke = 0.0;
9142  if (tkeNeeded) turb_ke = solver_container[TURB_SOL]->node[iPoint]->GetSolution(0);
9143 
9144  Density_b = Density_i;
9145  StaticEnergy_b = Energy_i - 0.5 * VelMagnitude2_i - turb_ke;
9146  Energy_b = StaticEnergy_b + 0.5 * VelMagnitude2_b + turb_ke;
9147 
9148  FluidModel->SetTDState_rhoe(Density_b, StaticEnergy_b);
9149  Kappa_b = FluidModel->GetdPde_rho() / Density_b;
9150  Chi_b = FluidModel->GetdPdrho_e() - Kappa_b * StaticEnergy_b;
9151  Pressure_b = FluidModel->GetPressure();
9152  Enthalpy_b = Energy_b + Pressure_b/Density_b;
9153 
9154  numerics->GetInviscidProjFlux(&Density_b, Velocity_b, &Pressure_b, &Enthalpy_b, NormalArea, Residual);
9155 
9156  /*--- Grid velocity correction to the energy term ---*/
9157  if (grid_movement) {
9158  GridVel = geometry->node[iPoint]->GetGridVel();
9159  ProjGridVel = 0.0;
9160  for (iDim = 0; iDim < nDim; iDim++)
9161  ProjGridVel += GridVel[iDim]*UnitNormal[iDim];
9162  Residual[nVar-1] += Pressure_b*ProjGridVel*Area;
9163  }
9164 
9165  /*--- Add the Reynolds stress tensor contribution ---*/
9166 
9167  if (tkeNeeded) {
9168  for (iDim = 0; iDim < nDim; iDim++)
9169  Residual[iDim+1] += (2.0/3.0)*Density_b*turb_ke*NormalArea[iDim];
9170  }
9171 
9172  /*--- Add value to the residual ---*/
9173 
9174  LinSysRes.AddBlock(iPoint, Residual);
9175 
9176  /*--- Form Jacobians for implicit computations ---*/
9177 
9178  if (implicit) {
9179 
9180  /*--- Initialize Jacobian ---*/
9181 
9182  for (iVar = 0; iVar < nVar; iVar++) {
9183  for (jVar = 0; jVar < nVar; jVar++)
9184  Jacobian_i[iVar][jVar] = 0.0;
9185  }
9186 
9187  /*--- Compute DubDu ---*/
9188 
9189  for (iVar = 0; iVar < nVar; iVar++) {
9190  for (jVar = 0; jVar < nVar; jVar++)
9191  DubDu[iVar][jVar]= 0.0;
9192  DubDu[iVar][iVar]= 1.0;
9193  }
9194 
9195  for (iDim = 0; iDim < nDim; iDim++)
9196  for (jDim = 0; jDim<nDim; jDim++)
9197  DubDu[iDim+1][jDim+1] -= UnitNormal[iDim]*UnitNormal[jDim];
9198  DubDu[nVar-1][0] += 0.5*ProjVelocity_i*ProjVelocity_i;
9199  for (iDim = 0; iDim < nDim; iDim++) {
9200  DubDu[nVar-1][iDim+1] -= ProjVelocity_i*UnitNormal[iDim];
9201  }
9202 
9203  /*--- Compute flux Jacobian in state b ---*/
9204 
9205  numerics->GetInviscidProjJac(Velocity_b, &Enthalpy_b, &Chi_b, &Kappa_b, NormalArea, 1, Jacobian_b);
9206 
9207  // Check for grid movement, should be already considered since Jacobian b is computed from u_b
9208  // if (grid_movement) {
9209  // Jacobian_b[nVar-1][0] += 0.5*ProjGridVel*ProjGridVel;
9210  // for (iDim = 0; iDim < nDim; iDim++)
9211  // Jacobian_b[nVar-1][iDim+1] -= ProjGridVel * UnitNormal[iDim];
9212  // }
9213 
9214  /*--- Compute numerical flux Jacobian at node i ---*/
9215 
9216  for (iVar = 0; iVar < nVar; iVar++)
9217  for (jVar = 0; jVar < nVar; jVar++)
9218  for (kVar = 0; kVar < nVar; kVar++)
9219  Jacobian_i[iVar][jVar] += Jacobian_b[iVar][kVar] * DubDu[kVar][jVar];
9220 
9221  /*--- Add the Jacobian to the sparse matrix ---*/
9222 
9223  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
9224 
9225  }
9226  }
9227  }
9228 
9229  delete [] Normal;
9230  delete [] NormalArea;
9231  delete [] Velocity_b;
9232  delete [] Velocity_i;
9233  for (iVar = 0; iVar < nVar; iVar++) {
9234  delete [] Jacobian_b[iVar];
9235  delete [] DubDu[iVar];
9236  }
9237  delete [] Jacobian_b;
9238  delete [] DubDu;
9239 
9240 }
9241 
9242 void CEulerSolver::BC_Euler_Transpiration(CGeometry *geometry, CSolver **solver_container,
9243  CNumerics *numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
9244 
9245  unsigned short iDim, iVar, jVar, kVar, jDim;
9246  unsigned long iPoint, iVertex;
9247  su2double *Normal = NULL, *GridVel = NULL, Area, UnitNormal[3], *NormalArea,
9248  ProjGridVel = 0.0, turb_ke;
9249  su2double Density_b, StaticEnergy_b, Enthalpy_b, *Velocity_b, Kappa_b, Chi_b, Energy_b, VelMagnitude2_b, Pressure_b;
9250  su2double Density_i, *Velocity_i, ProjVelocity_i = 0.0, Energy_i, VelMagnitude2_i, VelEps;
9251  su2double **Jacobian_b, **DubDu;
9252 
9253  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
9254  bool grid_movement = config->GetGrid_Movement();
9255  bool tkeNeeded = (((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS)) &&
9256  (config->GetKind_Turb_Model() == SST));
9257 
9258  Normal = new su2double[nDim];
9259  NormalArea = new su2double[nDim];
9260  Velocity_b = new su2double[nDim];
9261  Velocity_i = new su2double[nDim];
9262  Jacobian_b = new su2double*[nVar];
9263  DubDu = new su2double*[nVar];
9264  for (iVar = 0; iVar < nVar; iVar++) {
9265  Jacobian_b[iVar] = new su2double[nVar];
9266  DubDu[iVar] = new su2double[nVar];
9267  }
9268 
9269  /*--- Identify the boundary by string name ---*/
9270 
9271  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
9272 
9273  /*--- Loop over all the vertices on this boundary marker ---*/
9274 
9275  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
9276  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
9277 
9278  /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
9279 
9280  if (geometry->node[iPoint]->GetDomain()) {
9281 
9282  /*--- Normal vector for this vertex (negative for outward convention) ---*/
9283 
9284  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
9285 
9286  Area = 0.0;
9287  for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
9288  Area = sqrt (Area);
9289 
9290  for (iDim = 0; iDim < nDim; iDim++) {
9291  NormalArea[iDim] = -Normal[iDim];
9292  UnitNormal[iDim] = -Normal[iDim]/Area;
9293  }
9294 
9295  /*--- Get the state i ---*/
9296 
9297  VelMagnitude2_i = 0.0; ProjVelocity_i = 0.0;
9298  for (iDim = 0; iDim < nDim; iDim++) {
9299  Velocity_i[iDim] = node[iPoint]->GetVelocity(iDim);
9300  ProjVelocity_i += Velocity_i[iDim]*UnitNormal[iDim];
9301  VelMagnitude2_i += Velocity_i[iDim]*Velocity_i[iDim];
9302  }
9303  Density_i = node[iPoint]->GetDensity();
9304  Energy_i = node[iPoint]->GetEnergy();
9305 
9306  /*--- Compute the boundary state b ---*/
9307  VelEps = solver_container[FLOW_SOL]->node[iPoint]->GetTranspiration();
9308  for (iDim = 0; iDim < nDim; iDim++)
9309  Velocity_b[iDim] = Velocity_i[iDim] - (ProjVelocity_i + VelEps) * UnitNormal[iDim]; //Force the velocity to be the tangential + transpiration velocity.
9310 
9311  if (grid_movement) {
9312  GridVel = geometry->node[iPoint]->GetGridVel();
9313  ProjGridVel = 0.0;
9314  for (iDim = 0; iDim < nDim; iDim++) ProjGridVel += GridVel[iDim]*UnitNormal[iDim];
9315  for (iDim = 0; iDim < nDim; iDim++) Velocity_b[iDim] += GridVel[iDim] - ProjGridVel * UnitNormal[iDim];
9316  }
9317 
9318  VelMagnitude2_b = 0.0;
9319  for (iDim = 0; iDim < nDim; iDim++)
9320  VelMagnitude2_b += Velocity_b[iDim] * Velocity_b[iDim];
9321 
9322  /*--- Compute the residual ---*/
9323 
9324  turb_ke = 0.0;
9325  if (tkeNeeded) turb_ke = solver_container[TURB_SOL]->node[iPoint]->GetSolution(0);
9326 
9327  Density_b = Density_i;
9328  StaticEnergy_b = Energy_i - 0.5 * VelMagnitude2_i - turb_ke;
9329  Energy_b = StaticEnergy_b + 0.5 * VelMagnitude2_b + turb_ke;
9330 
9331  FluidModel->SetTDState_rhoe(Density_b, StaticEnergy_b);
9332  Kappa_b = FluidModel->GetdPde_rho() / Density_b;
9333  Chi_b = FluidModel->GetdPdrho_e() - Kappa_b * StaticEnergy_b;
9334  Pressure_b = FluidModel->GetPressure();
9335  Enthalpy_b = Energy_b + Pressure_b/Density_b;
9336 
9337  numerics->GetInviscidProjFlux(&Density_b, Velocity_b, &Pressure_b, &Enthalpy_b, NormalArea, Residual);
9338 
9339  /*--- Grid velocity correction to the energy term ---*/
9340  if (grid_movement) {
9341  GridVel = geometry->node[iPoint]->GetGridVel();
9342  ProjGridVel = 0.0;
9343  for (iDim = 0; iDim < nDim; iDim++)
9344  ProjGridVel += GridVel[iDim]*UnitNormal[iDim];
9345  Residual[nVar-1] += Pressure_b*ProjGridVel*Area;
9346  }
9347 
9348  /*--- Add the Reynolds stress tensor contribution ---*/
9349 
9350  if (tkeNeeded) {
9351  for (iDim = 0; iDim < nDim; iDim++)
9352  Residual[iDim+1] += (2.0/3.0)*Density_b*turb_ke*NormalArea[iDim];
9353  }
9354 
9355  /*--- Add value to the residual ---*/
9356 
9357  LinSysRes.AddBlock(iPoint, Residual);
9358 
9359  /*--- Form Jacobians for implicit computations ---*/
9360 
9361  if (implicit) {
9362 
9363  /*--- Initialize Jacobian ---*/
9364 
9365  for (iVar = 0; iVar < nVar; iVar++) {
9366  for (jVar = 0; jVar < nVar; jVar++)
9367  Jacobian_i[iVar][jVar] = 0.0;
9368  }
9369 
9370  /*--- Compute DubDu ---*/
9371 
9372  for (iVar = 0; iVar < nVar; iVar++) {
9373  for (jVar = 0; jVar < nVar; jVar++)
9374  DubDu[iVar][jVar]= 0.0;
9375  DubDu[iVar][iVar]= 1.0;
9376  }
9377 
9378  for (iDim = 0; iDim < nDim; iDim++)
9379  for (jDim = 0; jDim<nDim; jDim++)
9380  DubDu[iDim+1][jDim+1] -= UnitNormal[iDim]*UnitNormal[jDim];
9381  DubDu[nVar-1][0] += 0.5*ProjVelocity_i*ProjVelocity_i;
9382  for (iDim = 0; iDim < nDim; iDim++) {
9383  DubDu[nVar-1][iDim+1] -= ProjVelocity_i*UnitNormal[iDim];
9384  }
9385 
9386  /*--- Compute flux Jacobian in state b ---*/
9387 
9388  numerics->GetInviscidProjJac(Velocity_b, &Enthalpy_b, &Chi_b, &Kappa_b, NormalArea, 1, Jacobian_b);
9389 
9390  // Check for grid movement, should be already considered since Jacobian b is computed from u_b
9391  // if (grid_movement) {
9392  // Jacobian_b[nVar-1][0] += 0.5*ProjGridVel*ProjGridVel;
9393  // for (iDim = 0; iDim < nDim; iDim++)
9394  // Jacobian_b[nVar-1][iDim+1] -= ProjGridVel * UnitNormal[iDim];
9395  // }
9396 
9397  /*--- Compute numerical flux Jacobian at node i ---*/
9398 
9399  for (iVar = 0; iVar < nVar; iVar++)
9400  for (jVar = 0; jVar < nVar; jVar++)
9401  for (kVar = 0; kVar < nVar; kVar++)
9402  Jacobian_i[iVar][jVar] += Jacobian_b[iVar][kVar] * DubDu[kVar][jVar];
9403 
9404  /*--- Add the Jacobian to the sparse matrix ---*/
9405 
9406  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
9407 
9408  }
9409  }
9410  }
9411 
9412  delete [] Normal;
9413  delete [] NormalArea;
9414  delete [] Velocity_b;
9415  delete [] Velocity_i;
9416  for (iVar = 0; iVar < nVar; iVar++) {
9417  delete [] Jacobian_b[iVar];
9418  delete [] DubDu[iVar];
9419  }
9420  delete [] Jacobian_b;
9421  delete [] DubDu;
9422 
9423 }
9424 
9425 void CEulerSolver::BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics,
9426  CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
9427 
9428  unsigned short iDim;
9429  unsigned long iVertex, iPoint, Point_Normal;
9430 
9431  su2double *GridVel;
9432  su2double Area, UnitNormal[3] = {0.0,0.0,0.0};
9433  su2double Density, Pressure, Energy, Velocity[3] = {0.0,0.0,0.0};
9434  su2double Density_Bound, Pressure_Bound, Vel_Bound[3] = {0.0,0.0,0.0};
9435  su2double Density_Infty, Pressure_Infty, Vel_Infty[3] = {0.0,0.0,0.0};
9436  su2double SoundSpeed, Entropy, Velocity2, Vn;
9437  su2double SoundSpeed_Bound, Entropy_Bound, Vel2_Bound, Vn_Bound;
9438  su2double SoundSpeed_Infty, Entropy_Infty, Vel2_Infty, Vn_Infty, Qn_Infty;
9439  su2double RiemannPlus, RiemannMinus;
9440  su2double *V_infty, *V_domain;
9441 
9442  su2double Gas_Constant = config->GetGas_ConstantND();
9443 
9444  bool implicit = config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT;
9445  bool grid_movement = config->GetGrid_Movement();
9446  bool viscous = config->GetViscous();
9447  bool tkeNeeded = (((config->GetKind_Solver() == RANS ) ||
9448  (config->GetKind_Solver() == DISC_ADJ_RANS))
9449  && (config->GetKind_Turb_Model() == SST));
9450 
9451  su2double *Normal = new su2double[nDim];
9452 
9453  /*--- Loop over all the vertices on this boundary marker ---*/
9454 
9455  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
9456  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
9457 
9458  /*--- Allocate the value at the infinity ---*/
9459  V_infty = GetCharacPrimVar(val_marker, iVertex);
9460 
9461  /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
9462 
9463  if (geometry->node[iPoint]->GetDomain()) {
9464 
9465  /*--- Index of the closest interior node ---*/
9466 
9467  Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
9468 
9469  /*--- Normal vector for this vertex (negate for outward convention) ---*/
9470 
9471  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
9472  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
9473  conv_numerics->SetNormal(Normal);
9474 
9475  /*--- Retrieve solution at the farfield boundary node ---*/
9476  V_domain = node[iPoint]->GetPrimitive();
9477 
9478  /*--- Construct solution state at infinity for compressible flow by
9479  using Riemann invariants, and then impose a weak boundary condition
9480  by computing the flux using this new state for U. See CFD texts by
9481  Hirsch or Blazek for more detail. Adapted from an original
9482  implementation in the Stanford University multi-block (SUmb) solver
9483  in the routine bcFarfield.f90 written by Edwin van der Weide,
9484  last modified 06-12-2005. First, compute the unit normal at the
9485  boundary nodes. ---*/
9486 
9487  Area = 0.0;
9488  for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
9489  Area = sqrt(Area);
9490 
9491  for (iDim = 0; iDim < nDim; iDim++)
9492  UnitNormal[iDim] = Normal[iDim]/Area;
9493 
9494  /*--- Store primitive variables (density, velocities, velocity squared,
9495  energy, pressure, and sound speed) at the boundary node, and set some
9496  other quantities for clarity. Project the current flow velocity vector
9497  at this boundary node into the local normal direction, i.e. compute
9498  v_bound.n. ---*/
9499 
9500  Density_Bound = V_domain[nDim+2];
9501  Vel2_Bound = 0.0; Vn_Bound = 0.0;
9502  for (iDim = 0; iDim < nDim; iDim++) {
9503  Vel_Bound[iDim] = V_domain[iDim+1];
9504  Vel2_Bound += Vel_Bound[iDim]*Vel_Bound[iDim];
9505  Vn_Bound += Vel_Bound[iDim]*UnitNormal[iDim];
9506  }
9507  Pressure_Bound = node[iPoint]->GetPressure();
9508  SoundSpeed_Bound = sqrt(Gamma*Pressure_Bound/Density_Bound);
9509  Entropy_Bound = pow(Density_Bound, Gamma)/Pressure_Bound;
9510 
9511  /*--- Store the primitive variable state for the freestream. Project
9512  the freestream velocity vector into the local normal direction,
9513  i.e. compute v_infty.n. ---*/
9514 
9515  Density_Infty = GetDensity_Inf();
9516  Vel2_Infty = 0.0; Vn_Infty = 0.0;
9517  for (iDim = 0; iDim < nDim; iDim++) {
9518  Vel_Infty[iDim] = GetVelocity_Inf(iDim);
9519  Vel2_Infty += Vel_Infty[iDim]*Vel_Infty[iDim];
9520  Vn_Infty += Vel_Infty[iDim]*UnitNormal[iDim];
9521  }
9522  Pressure_Infty = GetPressure_Inf();
9523  SoundSpeed_Infty = sqrt(Gamma*Pressure_Infty/Density_Infty);
9524  Entropy_Infty = pow(Density_Infty, Gamma)/Pressure_Infty;
9525 
9526  /*--- Adjust the normal freestream velocity for grid movement ---*/
9527 
9528  Qn_Infty = Vn_Infty;
9529  if (grid_movement) {
9530  GridVel = geometry->node[iPoint]->GetGridVel();
9531  for (iDim = 0; iDim < nDim; iDim++)
9532  Qn_Infty -= GridVel[iDim]*UnitNormal[iDim];
9533  }
9534 
9535  /*--- Compute acoustic Riemann invariants: R = u.n +/- 2c/(gamma-1).
9536  These correspond with the eigenvalues (u+c) and (u-c), respectively,
9537  which represent the acoustic waves. Positive characteristics are
9538  incoming, and a physical boundary condition is imposed (freestream
9539  state). This occurs when either (u.n+c) > 0 or (u.n-c) > 0. Negative
9540  characteristics are leaving the domain, and numerical boundary
9541  conditions are required by extrapolating from the interior state
9542  using the Riemann invariants. This occurs when (u.n+c) < 0 or
9543  (u.n-c) < 0. Note that grid movement is taken into account when
9544  checking the sign of the eigenvalue. ---*/
9545 
9546  /*--- Check whether (u.n+c) is greater or less than zero ---*/
9547 
9548  if (Qn_Infty > -SoundSpeed_Infty) {
9549  /*--- Subsonic inflow or outflow ---*/
9550  RiemannPlus = Vn_Bound + 2.0*SoundSpeed_Bound/Gamma_Minus_One;
9551  } else {
9552  /*--- Supersonic inflow ---*/
9553  RiemannPlus = Vn_Infty + 2.0*SoundSpeed_Infty/Gamma_Minus_One;
9554  }
9555 
9556  /*--- Check whether (u.n-c) is greater or less than zero ---*/
9557 
9558  if (Qn_Infty > SoundSpeed_Infty) {
9559  /*--- Supersonic outflow ---*/
9560  RiemannMinus = Vn_Bound - 2.0*SoundSpeed_Bound/Gamma_Minus_One;
9561  } else {
9562  /*--- Subsonic outflow ---*/
9563  RiemannMinus = Vn_Infty - 2.0*SoundSpeed_Infty/Gamma_Minus_One;
9564  }
9565 
9566  /*--- Compute a new value for the local normal velocity and speed of
9567  sound from the Riemann invariants. ---*/
9568 
9569  Vn = 0.5 * (RiemannPlus + RiemannMinus);
9570  SoundSpeed = 0.25 * (RiemannPlus - RiemannMinus)*Gamma_Minus_One;
9571 
9572  /*--- Construct the primitive variable state at the boundary for
9573  computing the flux for the weak boundary condition. The values
9574  that we choose to construct the solution (boundary or freestream)
9575  depend on whether we are at an inflow or outflow. At an outflow, we
9576  choose boundary information (at most one characteristic is incoming),
9577  while at an inflow, we choose infinity values (at most one
9578  characteristic is outgoing). ---*/
9579 
9580  if (Qn_Infty > 0.0) {
9581  /*--- Outflow conditions ---*/
9582  for (iDim = 0; iDim < nDim; iDim++)
9583  Velocity[iDim] = Vel_Bound[iDim] + (Vn-Vn_Bound)*UnitNormal[iDim];
9584  Entropy = Entropy_Bound;
9585  } else {
9586  /*--- Inflow conditions ---*/
9587  for (iDim = 0; iDim < nDim; iDim++)
9588  Velocity[iDim] = Vel_Infty[iDim] + (Vn-Vn_Infty)*UnitNormal[iDim];
9589  Entropy = Entropy_Infty;
9590  }
9591 
9592  /*--- Recompute the primitive variables. ---*/
9593 
9594  Density = pow(Entropy*SoundSpeed*SoundSpeed/Gamma,1.0/Gamma_Minus_One);
9595  Velocity2 = 0.0;
9596  for (iDim = 0; iDim < nDim; iDim++) {
9597  Velocity2 += Velocity[iDim]*Velocity[iDim];
9598  }
9599  Pressure = Density*SoundSpeed*SoundSpeed/Gamma;
9600  Energy = Pressure/(Gamma_Minus_One*Density) + 0.5*Velocity2;
9601  if (tkeNeeded) Energy += GetTke_Inf();
9602 
9603  /*--- Store new primitive state for computing the flux. ---*/
9604 
9605  V_infty[0] = Pressure/(Gas_Constant*Density);
9606  for (iDim = 0; iDim < nDim; iDim++)
9607  V_infty[iDim+1] = Velocity[iDim];
9608  V_infty[nDim+1] = Pressure;
9609  V_infty[nDim+2] = Density;
9610  V_infty[nDim+3] = Energy + Pressure/Density;
9611 
9612 
9613 
9614  /*--- Set various quantities in the numerics class ---*/
9615 
9616  conv_numerics->SetPrimitive(V_domain, V_infty);
9617 
9618  if (grid_movement) {
9619  conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
9620  geometry->node[iPoint]->GetGridVel());
9621  }
9622 
9623  /*--- Compute the convective residual using an upwind scheme ---*/
9624 
9625  conv_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
9626 
9627  /*--- Update residual value ---*/
9628 
9629  LinSysRes.AddBlock(iPoint, Residual);
9630 
9631  /*--- Convective Jacobian contribution for implicit integration ---*/
9632 
9633  if (implicit)
9634  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
9635 
9636  /*--- Roe Turkel preconditioning, set the value of beta ---*/
9637 
9638  if (config->GetKind_Upwind() == TURKEL)
9639  node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta());
9640 
9641  /*--- Viscous residual contribution ---*/
9642 
9643  if (viscous) {
9644 
9645  /*--- Set laminar and eddy viscosity at the infinity ---*/
9646 
9647  V_infty[nDim+5] = node[iPoint]->GetLaminarViscosity();
9648  V_infty[nDim+6] = node[iPoint]->GetEddyViscosity();
9649 
9650  /*--- Set the normal vector and the coordinates ---*/
9651 
9652  visc_numerics->SetNormal(Normal);
9653  visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(),
9654  geometry->node[Point_Normal]->GetCoord());
9655 
9656  /*--- Primitive variables, and gradient ---*/
9657 
9658  visc_numerics->SetPrimitive(V_domain, V_infty);
9659  visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(),
9660  node[iPoint]->GetGradient_Primitive());
9661 
9662  /*--- Turbulent kinetic energy ---*/
9663 
9664  if (config->GetKind_Turb_Model() == SST)
9665  visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0),
9666  solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
9667 
9668  /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
9669 
9670  visc_numerics->SetTauWall(-1.0, -1.0);
9671 
9672  /*--- Compute and update viscous residual ---*/
9673 
9674  visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
9675  LinSysRes.SubtractBlock(iPoint, Residual);
9676 
9677  /*--- Viscous Jacobian contribution for implicit integration ---*/
9678 
9679  if (implicit)
9680  Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
9681 
9682  }
9683 
9684  }
9685  }
9686 
9687  /*--- Free locally allocated memory ---*/
9688  delete [] Normal;
9689 
9690 }
9691 
9692 void CEulerSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container,
9693  CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
9694  unsigned short iDim, iVar, jVar, kVar;
9695  unsigned long iVertex, iPoint, Point_Normal;
9696  su2double P_Total, T_Total, P_static, T_static, Rho_static, *Mach, *Flow_Dir, Area, UnitNormal[3];
9697  su2double *Velocity_b, Velocity2_b, Enthalpy_b, Energy_b, StaticEnergy_b, Density_b, Kappa_b, Chi_b, Pressure_b, Temperature_b;
9698  su2double *Velocity_e, Velocity2_e, VelMag_e, Enthalpy_e, Entropy_e, Energy_e = 0.0, StaticEnthalpy_e, StaticEnergy_e, Density_e = 0.0, Pressure_e;
9699  su2double *Velocity_i, Velocity2_i, Enthalpy_i, Energy_i, StaticEnergy_i, Density_i, Kappa_i, Chi_i, Pressure_i, SoundSpeed_i;
9700  su2double ProjVelocity_i;
9701  su2double **P_Tensor, **invP_Tensor, *Lambda_i, **Jacobian_b, **DubDu, *dw, *u_e, *u_i, *u_b;
9702  su2double *gridVel;
9703  su2double *V_boundary, *V_domain, *S_boundary, *S_domain;
9704 
9705  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
9706  bool grid_movement = config->GetGrid_Movement();
9707  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
9708  bool viscous = config->GetViscous();
9709  bool gravity = (config->GetGravityForce());
9710  bool tkeNeeded = (((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS)) &&
9711  (config->GetKind_Turb_Model() == SST));
9712 
9713  su2double *Normal, *FlowDirMix, TangVelocity, NormalVelocity;
9714  Normal = new su2double[nDim];
9715 
9716  Velocity_i = new su2double[nDim];
9717  Velocity_b = new su2double[nDim];
9718  Velocity_e = new su2double[nDim];
9719  FlowDirMix = new su2double[nDim];
9720  Lambda_i = new su2double[nVar];
9721  u_i = new su2double[nVar];
9722  u_e = new su2double[nVar];
9723  u_b = new su2double[nVar];
9724  dw = new su2double[nVar];
9725 
9726  S_boundary = new su2double[8];
9727 
9728  P_Tensor = new su2double*[nVar];
9729  invP_Tensor = new su2double*[nVar];
9730  for (iVar = 0; iVar < nVar; iVar++)
9731  {
9732  P_Tensor[iVar] = new su2double[nVar];
9733  invP_Tensor[iVar] = new su2double[nVar];
9734  }
9735 
9736  /*--- Loop over all the vertices on this boundary marker ---*/
9737  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
9738 
9739  V_boundary= GetCharacPrimVar(val_marker, iVertex);
9740 
9741  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
9742 
9743  /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
9744  if (geometry->node[iPoint]->GetDomain()) {
9745 
9746  /*--- Index of the closest interior node ---*/
9747  Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
9748 
9749  /*--- Normal vector for this vertex (negate for outward convention) ---*/
9750  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
9751  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
9752  conv_numerics->SetNormal(Normal);
9753 
9754  Area = 0.0;
9755  for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
9756  Area = sqrt (Area);
9757 
9758  for (iDim = 0; iDim < nDim; iDim++)
9759  UnitNormal[iDim] = Normal[iDim]/Area;
9760 
9761  /*--- Retrieve solution at this boundary node ---*/
9762  V_domain = node[iPoint]->GetPrimitive();
9763 
9764  /*--- Compute the internal state u_i ---*/
9765  Velocity2_i = 0;
9766  for (iDim=0; iDim < nDim; iDim++)
9767  {
9768  Velocity_i[iDim] = node[iPoint]->GetVelocity(iDim);
9769  Velocity2_i += Velocity_i[iDim]*Velocity_i[iDim];
9770  }
9771 
9772 
9773  Density_i = node[iPoint]->GetDensity();
9774 
9775  Energy_i = node[iPoint]->GetEnergy();
9776  StaticEnergy_i = Energy_i - 0.5*Velocity2_i;
9777 
9778  FluidModel->SetTDState_rhoe(Density_i, StaticEnergy_i);
9779 
9780  Pressure_i = FluidModel->GetPressure();
9781  Enthalpy_i = Energy_i + Pressure_i/Density_i;
9782 
9783  SoundSpeed_i = FluidModel->GetSoundSpeed();
9784 
9785  Kappa_i = FluidModel->GetdPde_rho() / Density_i;
9786  Chi_i = FluidModel->GetdPdrho_e() - Kappa_i * StaticEnergy_i;
9787 
9788  ProjVelocity_i = 0.0;
9789  for (iDim = 0; iDim < nDim; iDim++)
9790  ProjVelocity_i += Velocity_i[iDim]*UnitNormal[iDim];
9791 
9792  /*--- Build the external state u_e from boundary data and internal node ---*/
9793 
9794  switch(config->GetKind_Data_Riemann(Marker_Tag))
9795  {
9796  case TOTAL_CONDITIONS_PT:
9797 
9798  /*--- Retrieve the specified total conditions for this boundary. ---*/
9799  if (gravity) P_Total = config->GetRiemann_Var1(Marker_Tag) - geometry->node[iPoint]->GetCoord(nDim-1)*STANDARD_GRAVITY;
9800  else P_Total = config->GetRiemann_Var1(Marker_Tag);
9801  T_Total = config->GetRiemann_Var2(Marker_Tag);
9802  Flow_Dir = config->GetRiemann_FlowDir(Marker_Tag);
9803 
9804  /*--- Non-dim. the inputs if necessary. ---*/
9805  P_Total /= config->GetPressure_Ref();
9806  T_Total /= config->GetTemperature_Ref();
9807 
9808  /* --- Computes the total state --- */
9809  FluidModel->SetTDState_PT(P_Total, T_Total);
9811  Entropy_e = FluidModel->GetEntropy();
9812 
9813  /* --- Compute the boundary state u_e --- */
9814  Velocity2_e = Velocity2_i;
9815  if (nDim == 2){
9816  NormalVelocity= -sqrt(Velocity2_e)*Flow_Dir[0];
9817  TangVelocity= -sqrt(Velocity2_e)*Flow_Dir[1];
9818  Velocity_e[0]= UnitNormal[0]*NormalVelocity - UnitNormal[1]*TangVelocity;
9819  Velocity_e[1]= UnitNormal[1]*NormalVelocity + UnitNormal[0]*TangVelocity;
9820  }else{
9821  for (iDim = 0; iDim < nDim; iDim++)
9822  Velocity_e[iDim] = sqrt(Velocity2_e)*Flow_Dir[iDim];
9823  }
9824  StaticEnthalpy_e = Enthalpy_e - 0.5 * Velocity2_e;
9825  FluidModel->SetTDState_hs(StaticEnthalpy_e, Entropy_e);
9826  Density_e = FluidModel->GetDensity();
9827  StaticEnergy_e = FluidModel->GetStaticEnergy();
9828  Energy_e = StaticEnergy_e + 0.5 * Velocity2_e;
9829  if (tkeNeeded) Energy_e += GetTke_Inf();
9830  break;
9831 
9833 
9834  /*--- Retrieve the specified total conditions for this boundary. ---*/
9835  if (gravity) P_static = config->GetRiemann_Var1(Marker_Tag) - geometry->node[iPoint]->GetCoord(nDim-1)*STANDARD_GRAVITY;
9836  else P_static = config->GetRiemann_Var1(Marker_Tag);
9837  T_static = config->GetRiemann_Var2(Marker_Tag);
9838  Mach = config->GetRiemann_FlowDir(Marker_Tag);
9839 
9840  /*--- Non-dim. the inputs if necessary. ---*/
9841  P_static /= config->GetPressure_Ref();
9842  T_static /= config->GetTemperature_Ref();
9843 
9844  /* --- Computes the total state --- */
9845  FluidModel->SetTDState_PT(P_static, T_static);
9846 
9847  /* --- Compute the boundary state u_e --- */
9848  Velocity2_e = 0.0;
9849  for (iDim = 0; iDim < nDim; iDim++) {
9850  Velocity_e[iDim] = Mach[iDim]*FluidModel->GetSoundSpeed();
9851  Velocity2_e += Velocity_e[iDim]*Velocity_e[iDim];
9852  }
9853  Density_e = FluidModel->GetDensity();
9854  StaticEnergy_e = FluidModel->GetStaticEnergy();
9855  Energy_e = StaticEnergy_e + 0.5 * Velocity2_e;
9856  if (tkeNeeded) Energy_e += GetTke_Inf();
9857  break;
9858 
9860 
9861  /*--- Retrieve the specified total conditions for this boundary. ---*/
9862 
9863  if (gravity) P_static = config->GetRiemann_Var1(Marker_Tag) - geometry->node[iPoint]->GetCoord(nDim-1)*STANDARD_GRAVITY;
9864  else P_static = config->GetRiemann_Var1(Marker_Tag);
9865  Rho_static = config->GetRiemann_Var2(Marker_Tag);
9866  Mach = config->GetRiemann_FlowDir(Marker_Tag);
9867 
9868  /*--- Non-dim. the inputs if necessary. ---*/
9869  P_static /= config->GetPressure_Ref();
9870  Rho_static /= config->GetDensity_Ref();
9871 
9872  /* --- Computes the total state --- */
9873  FluidModel->SetTDState_Prho(P_static, Rho_static);
9874 
9875  /* --- Compute the boundary state u_e --- */
9876  Velocity2_e = 0.0;
9877  for (iDim = 0; iDim < nDim; iDim++) {
9878  Velocity_e[iDim] = Mach[iDim]*FluidModel->GetSoundSpeed();
9879  Velocity2_e += Velocity_e[iDim]*Velocity_e[iDim];
9880  }
9881  Density_e = FluidModel->GetDensity();
9882  StaticEnergy_e = FluidModel->GetStaticEnergy();
9883  Energy_e = StaticEnergy_e + 0.5 * Velocity2_e;
9884  if (tkeNeeded) Energy_e += GetTke_Inf();
9885  break;
9886 
9887  case DENSITY_VELOCITY:
9888 
9889  /*--- Retrieve the specified density and velocity magnitude ---*/
9890  Density_e = config->GetRiemann_Var1(Marker_Tag);
9891  VelMag_e = config->GetRiemann_Var2(Marker_Tag);
9892  Flow_Dir = config->GetRiemann_FlowDir(Marker_Tag);
9893 
9894  /*--- Non-dim. the inputs if necessary. ---*/
9895  Density_e /= config->GetDensity_Ref();
9896  VelMag_e /= config->GetVelocity_Ref();
9897 
9898  for (iDim = 0; iDim < nDim; iDim++)
9899  Velocity_e[iDim] = VelMag_e*Flow_Dir[iDim];
9900  Energy_e = Energy_i;
9901  break;
9902 
9903  case STATIC_PRESSURE:
9904 
9905  /*--- Retrieve the staic pressure for this boundary. ---*/
9906  Pressure_e = config->GetRiemann_Var1(Marker_Tag);
9907  Pressure_e /= config->GetPressure_Ref();
9908  Density_e = Density_i;
9909 
9910  /* --- Compute the boundary state u_e --- */
9911  FluidModel->SetTDState_Prho(Pressure_e, Density_e);
9912  Velocity2_e = 0.0;
9913  for (iDim = 0; iDim < nDim; iDim++) {
9914  Velocity_e[iDim] = Velocity_i[iDim];
9915  Velocity2_e += Velocity_e[iDim]*Velocity_e[iDim];
9916  }
9917  Energy_e = FluidModel->GetStaticEnergy() + 0.5*Velocity2_e;
9918  break;
9919 
9920  default:
9921  SU2_MPI::Error("Invalid Riemann input!", CURRENT_FUNCTION);
9922  break;
9923  }
9924 
9925  /*--- Compute P (matrix of right eigenvectors) ---*/
9926  conv_numerics->GetPMatrix(&Density_i, Velocity_i, &SoundSpeed_i, &Enthalpy_i, &Chi_i, &Kappa_i, UnitNormal, P_Tensor);
9927 
9928  /*--- Compute inverse P (matrix of left eigenvectors)---*/
9929  conv_numerics->GetPMatrix_inv(invP_Tensor, &Density_i, Velocity_i, &SoundSpeed_i, &Chi_i, &Kappa_i, UnitNormal);
9930 
9931  /*--- eigenvalues contribution due to grid motion ---*/
9932  if (grid_movement) {
9933  gridVel = geometry->node[iPoint]->GetGridVel();
9934 
9935  su2double ProjGridVel = 0.0;
9936  for (iDim = 0; iDim < nDim; iDim++)
9937  ProjGridVel += gridVel[iDim]*UnitNormal[iDim];
9938  ProjVelocity_i -= ProjGridVel;
9939  }
9940 
9941  /*--- Flow eigenvalues ---*/
9942  for (iDim = 0; iDim < nDim; iDim++)
9943  Lambda_i[iDim] = ProjVelocity_i;
9944  Lambda_i[nVar-2] = ProjVelocity_i + SoundSpeed_i;
9945  Lambda_i[nVar-1] = ProjVelocity_i - SoundSpeed_i;
9946 
9947  /*--- Compute the boundary state u_e ---*/
9948  u_e[0] = Density_e;
9949  for (iDim = 0; iDim < nDim; iDim++)
9950  u_e[iDim+1] = Velocity_e[iDim]*Density_e;
9951  u_e[nVar-1] = Energy_e*Density_e;
9952 
9953  /*--- Compute the boundary state u_i ---*/
9954  u_i[0] = Density_i;
9955  for (iDim = 0; iDim < nDim; iDim++)
9956  u_i[iDim+1] = Velocity_i[iDim]*Density_i;
9957  u_i[nVar-1] = Energy_i*Density_i;
9958 
9959  /*--- Compute the characteristic jumps ---*/
9960  for (iVar = 0; iVar < nVar; iVar++)
9961  {
9962  dw[iVar] = 0;
9963  for (jVar = 0; jVar < nVar; jVar++)
9964  dw[iVar] += invP_Tensor[iVar][jVar] * (u_e[jVar] - u_i[jVar]);
9965 
9966  }
9967 
9968  /*--- Compute the boundary state u_b using characteristics ---*/
9969  for (iVar = 0; iVar < nVar; iVar++)
9970  {
9971  u_b[iVar] = u_i[iVar];
9972 
9973  for (jVar = 0; jVar < nVar; jVar++)
9974  {
9975  if (Lambda_i[jVar] < 0)
9976  {
9977  u_b[iVar] += P_Tensor[iVar][jVar]*dw[jVar];
9978 
9979  }
9980  }
9981  }
9982 
9983 
9984  /*--- Compute the thermodynamic state in u_b ---*/
9985  Density_b = u_b[0];
9986  Velocity2_b = 0;
9987  for (iDim = 0; iDim < nDim; iDim++)
9988  {
9989  Velocity_b[iDim] = u_b[iDim+1]/Density_b;
9990  Velocity2_b += Velocity_b[iDim]*Velocity_b[iDim];
9991  }
9992  Energy_b = u_b[nVar-1]/Density_b;
9993  StaticEnergy_b = Energy_b - 0.5*Velocity2_b;
9994  FluidModel->SetTDState_rhoe(Density_b, StaticEnergy_b);
9995  Pressure_b = FluidModel->GetPressure();
9996  Temperature_b = FluidModel->GetTemperature();
9997  Enthalpy_b = Energy_b + Pressure_b/Density_b;
9998  Kappa_b = FluidModel->GetdPde_rho() / Density_b;
9999  Chi_b = FluidModel->GetdPdrho_e() - Kappa_b * StaticEnergy_b;
10000 
10001  /*--- Compute the residuals ---*/
10002  conv_numerics->GetInviscidProjFlux(&Density_b, Velocity_b, &Pressure_b, &Enthalpy_b, Normal, Residual);
10003 
10004  /*--- Residual contribution due to grid motion ---*/
10005  if (grid_movement) {
10006  gridVel = geometry->node[iPoint]->GetGridVel();
10007  su2double projVelocity = 0.0;
10008 
10009  for (iDim = 0; iDim < nDim; iDim++)
10010  projVelocity += gridVel[iDim]*Normal[iDim];
10011  for (iVar = 0; iVar < nVar; iVar++)
10012  Residual[iVar] -= projVelocity *(u_b[iVar]);
10013  }
10014 
10015  if (implicit) {
10016 
10017  Jacobian_b = new su2double*[nVar];
10018  DubDu = new su2double*[nVar];
10019  for (iVar = 0; iVar < nVar; iVar++)
10020  {
10021  Jacobian_b[iVar] = new su2double[nVar];
10022  DubDu[iVar] = new su2double[nVar];
10023  }
10024 
10025  /*--- Initialize DubDu to unit matrix---*/
10026 
10027  for (iVar = 0; iVar < nVar; iVar++)
10028  {
10029  for (jVar = 0; jVar < nVar; jVar++)
10030  DubDu[iVar][jVar]= 0;
10031 
10032  DubDu[iVar][iVar]= 1;
10033  }
10034 
10035  /*--- Compute DubDu -= RNL---*/
10036  for (iVar=0; iVar<nVar; iVar++)
10037  {
10038  for (jVar=0; jVar<nVar; jVar++)
10039  {
10040  for (kVar=0; kVar<nVar; kVar++)
10041  {
10042  if (Lambda_i[kVar]<0)
10043  DubDu[iVar][jVar] -= P_Tensor[iVar][kVar] * invP_Tensor[kVar][jVar];
10044  }
10045  }
10046  }
10047 
10048  /*--- Compute flux Jacobian in state b ---*/
10049  conv_numerics->GetInviscidProjJac(Velocity_b, &Enthalpy_b, &Chi_b, &Kappa_b, Normal, 1.0, Jacobian_b);
10050 
10051  /*--- Jacobian contribution due to grid motion ---*/
10052  if (grid_movement)
10053  {
10054  gridVel = geometry->node[iPoint]->GetGridVel();
10055  su2double projVelocity = 0.0;
10056  for (iDim = 0; iDim < nDim; iDim++)
10057  projVelocity += gridVel[iDim]*Normal[iDim];
10058  for (iVar = 0; iVar < nVar; iVar++) {
10059  Residual[iVar] -= projVelocity *(u_b[iVar]);
10060  Jacobian_b[iVar][iVar] -= projVelocity;
10061  }
10062 
10063  }
10064 
10065  /*--- initiate Jacobian_i to zero matrix ---*/
10066  for (iVar=0; iVar<nVar; iVar++)
10067  for (jVar=0; jVar<nVar; jVar++)
10068  Jacobian_i[iVar][jVar] = 0.0;
10069 
10070  /*--- Compute numerical flux Jacobian at node i ---*/
10071  for (iVar=0; iVar<nVar; iVar++) {
10072  for (jVar=0; jVar<nVar; jVar++) {
10073  for (kVar=0; kVar<nVar; kVar++) {
10074  Jacobian_i[iVar][jVar] += Jacobian_b[iVar][kVar] * DubDu[kVar][jVar];
10075  }
10076  }
10077  }
10078 
10079  for (iVar = 0; iVar < nVar; iVar++) {
10080  delete [] Jacobian_b[iVar];
10081  delete [] DubDu[iVar];
10082  }
10083  delete [] Jacobian_b;
10084  delete [] DubDu;
10085  }
10086 
10087  /*--- Update residual value ---*/
10088  LinSysRes.AddBlock(iPoint, Residual);
10089 
10090  /*--- Jacobian contribution for implicit integration ---*/
10091  if (implicit)
10092  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
10093 
10094  /*--- Roe Turkel preconditioning, set the value of beta ---*/
10095  if (config->GetKind_Upwind() == TURKEL)
10096  node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta());
10097 
10098  /*--- Viscous contribution ---*/
10099 
10100  if (viscous) {
10101 
10102  /*--- Primitive variables, using the derived quantities ---*/
10103 
10104  V_boundary[0] = Temperature_b;
10105  for (iDim = 0; iDim < nDim; iDim++)
10106  V_boundary[iDim+1] = Velocity_b[iDim];
10107  V_boundary[nDim+1] = Pressure_b;
10108  V_boundary[nDim+2] = Density_b;
10109  V_boundary[nDim+3] = Enthalpy_b;
10110 
10111  /*--- Set laminar and eddy viscosity at the infinity ---*/
10112 
10113  V_boundary[nDim+5] = FluidModel->GetLaminarViscosity();
10114  V_boundary[nDim+6] = node[iPoint]->GetEddyViscosity();
10115  V_boundary[nDim+7] = FluidModel->GetThermalConductivity();
10116  V_boundary[nDim+8] = FluidModel->GetCp();
10117 
10118  /*--- Set the normal vector and the coordinates ---*/
10119 
10120  visc_numerics->SetNormal(Normal);
10121  visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
10122 
10123  /*--- Primitive variables, and gradient ---*/
10124 
10125  visc_numerics->SetPrimitive(V_domain, V_boundary);
10126  visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
10127 
10128  /*--- Secondary variables ---*/
10129 
10130  S_domain = node[iPoint]->GetSecondary();
10131 
10132  /*--- Compute secondary thermodynamic properties (partial derivatives...) ---*/
10133 
10134  S_boundary[0]= FluidModel->GetdPdrho_e();
10135  S_boundary[1]= FluidModel->GetdPde_rho();
10136 
10137  S_boundary[2]= FluidModel->GetdTdrho_e();
10138  S_boundary[3]= FluidModel->GetdTde_rho();
10139 
10140  /*--- Compute secondary thermo-physical properties (partial derivatives...) ---*/
10141 
10142  S_boundary[4]= FluidModel->Getdmudrho_T();
10143  S_boundary[5]= FluidModel->GetdmudT_rho();
10144 
10145  S_boundary[6]= FluidModel->Getdktdrho_T();
10146  S_boundary[7]= FluidModel->GetdktdT_rho();
10147 
10148  visc_numerics->SetSecondary(S_domain, S_boundary);
10149 
10150  /*--- Turbulent kinetic energy ---*/
10151 
10152  if (config->GetKind_Turb_Model() == SST)
10153  visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
10154 
10155  /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
10156 
10157  visc_numerics->SetTauWall(-1.0, -1.0);
10158 
10159  /*--- Compute and update residual ---*/
10160 
10161  visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
10162  LinSysRes.SubtractBlock(iPoint, Residual);
10163 
10164  /*--- Jacobian contribution for implicit integration ---*/
10165 
10166  if (implicit)
10167  Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
10168 
10169  }
10170 
10171  }
10172  }
10173 
10174  /*--- Free locally allocated memory ---*/
10175  delete [] Normal;
10176  delete [] Velocity_e;
10177  delete [] Velocity_b;
10178  delete [] Velocity_i;
10179  delete [] FlowDirMix;
10180 
10181  delete [] S_boundary;
10182  delete [] Lambda_i;
10183  delete [] u_i;
10184  delete [] u_e;
10185  delete [] u_b;
10186  delete [] dw;
10187 
10188 
10189  for (iVar = 0; iVar < nVar; iVar++)
10190  {
10191  delete [] P_Tensor[iVar];
10192  delete [] invP_Tensor[iVar];
10193  }
10194  delete [] P_Tensor;
10195  delete [] invP_Tensor;
10196 
10197 }
10198 
10199 
10200 void CEulerSolver::BC_TurboRiemann(CGeometry *geometry, CSolver **solver_container,
10201  CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
10202  unsigned short iDim, iVar, jVar, kVar, iSpan;
10203  unsigned long iPoint, Point_Normal, oldVertex;
10204  long iVertex;
10205  su2double P_Total, T_Total, *Flow_Dir;
10206  su2double *Velocity_b, Velocity2_b, Enthalpy_b, Energy_b, StaticEnergy_b, Density_b, Kappa_b, Chi_b, Pressure_b, Temperature_b;
10207  su2double *Velocity_e, Velocity2_e, Enthalpy_e, Entropy_e, Energy_e = 0.0, StaticEnthalpy_e, StaticEnergy_e, Density_e = 0.0, Pressure_e;
10208  su2double *Velocity_i, Velocity2_i, Enthalpy_i, Energy_i, StaticEnergy_i, Density_i, Kappa_i, Chi_i, Pressure_i, SoundSpeed_i;
10209  su2double ProjVelocity_i;
10210  su2double **P_Tensor, **invP_Tensor, *Lambda_i, **Jacobian_b, **DubDu, *dw, *u_e, *u_i, *u_b;
10211  su2double *gridVel;
10212  su2double *V_boundary, *V_domain, *S_boundary, *S_domain;
10213  su2double AverageEnthalpy, AverageEntropy;
10214  unsigned short iZone = config->GetiZone();
10215  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
10216  bool grid_movement = config->GetGrid_Movement();
10217  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
10218  unsigned short nSpanWiseSections = geometry->GetnSpanWiseSections(config->GetMarker_All_TurbomachineryFlag(val_marker));
10219  bool viscous = config->GetViscous();
10220  bool gravity = (config->GetGravityForce());
10221  bool tkeNeeded = (((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS)) &&
10222  (config->GetKind_Turb_Model() == SST));
10223 
10224  su2double *Normal, *turboNormal, *UnitNormal, *FlowDirMix, FlowDirMixMag, *turboVelocity;
10225  Normal = new su2double[nDim];
10226  turboNormal = new su2double[nDim];
10227  UnitNormal = new su2double[nDim];
10228 
10229  Velocity_i = new su2double[nDim];
10230  Velocity_b = new su2double[nDim];
10231  Velocity_e = new su2double[nDim];
10232  turboVelocity = new su2double[nDim];
10233  FlowDirMix = new su2double[nDim];
10234  Lambda_i = new su2double[nVar];
10235  u_i = new su2double[nVar];
10236  u_e = new su2double[nVar];
10237  u_b = new su2double[nVar];
10238  dw = new su2double[nVar];
10239 
10240  S_boundary = new su2double[8];
10241 
10242  P_Tensor = new su2double*[nVar];
10243  invP_Tensor = new su2double*[nVar];
10244  for (iVar = 0; iVar < nVar; iVar++)
10245  {
10246  P_Tensor[iVar] = new su2double[nVar];
10247  invP_Tensor[iVar] = new su2double[nVar];
10248  }
10249 
10250  /*--- Loop over all the vertices on this boundary marker ---*/
10251  for (iSpan= 0; iSpan < nSpanWiseSections; iSpan++){
10252  for (iVertex = 0; iVertex < geometry->nVertexSpan[val_marker][iSpan]; iVertex++) {
10253 
10254  /*--- using the other vertex information for retrieving some information ---*/
10255  oldVertex = geometry->turbovertex[val_marker][iSpan][iVertex]->GetOldVertex();
10256  V_boundary= GetCharacPrimVar(val_marker, oldVertex);
10257 
10258  /*--- Index of the closest interior node ---*/
10259  Point_Normal = geometry->vertex[val_marker][oldVertex]->GetNormal_Neighbor();
10260 
10261  /*--- Normal vector for this vertex (negate for outward convention),
10262  * this normal is scaled with the area of the face of the element ---*/
10263  geometry->vertex[val_marker][oldVertex]->GetNormal(Normal);
10264  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
10265  conv_numerics->SetNormal(Normal);
10266 
10267  /*--- find the node related to the vertex ---*/
10268  iPoint = geometry->turbovertex[val_marker][iSpan][iVertex]->GetNode();
10269  if (geometry->node[iPoint]->GetDomain()){
10270 
10271  /*--- Normalize Normal vector for this vertex (already for outward convention) ---*/
10272  geometry->turbovertex[val_marker][iSpan][iVertex]->GetNormal(UnitNormal);
10273  geometry->turbovertex[val_marker][iSpan][iVertex]->GetTurboNormal(turboNormal);
10274 
10275  /*--- Retrieve solution at this boundary node ---*/
10276  V_domain = node[iPoint]->GetPrimitive();
10277 
10278  /* --- Compute the internal state u_i --- */
10279  Velocity2_i = 0;
10280  for (iDim=0; iDim < nDim; iDim++)
10281  {
10282  Velocity_i[iDim] = node[iPoint]->GetVelocity(iDim);
10283  Velocity2_i += Velocity_i[iDim]*Velocity_i[iDim];
10284  }
10285 
10286  Density_i = node[iPoint]->GetDensity();
10287 
10288  Energy_i = node[iPoint]->GetEnergy();
10289  StaticEnergy_i = Energy_i - 0.5*Velocity2_i;
10290 
10291  FluidModel->SetTDState_rhoe(Density_i, StaticEnergy_i);
10292 
10293  Pressure_i = FluidModel->GetPressure();
10294  Enthalpy_i = Energy_i + Pressure_i/Density_i;
10295 
10296  SoundSpeed_i = FluidModel->GetSoundSpeed();
10297 
10298  Kappa_i = FluidModel->GetdPde_rho() / Density_i;
10299  Chi_i = FluidModel->GetdPdrho_e() - Kappa_i * StaticEnergy_i;
10300 
10301  ProjVelocity_i = 0.0;
10302  for (iDim = 0; iDim < nDim; iDim++)
10303  ProjVelocity_i += Velocity_i[iDim]*UnitNormal[iDim];
10304 
10305  /*--- Build the external state u_e from boundary data and internal node ---*/
10306 
10307  switch(config->GetKind_Data_Riemann(Marker_Tag))
10308  {
10309  //TODO(turbo), generilize for 3D case
10310  //TODO(turbo), generilize for Inlet and Outlet in for backflow treatment
10311  //TODO(turbo), implement not uniform inlet and radial equilibrium for the outlet
10312  case TOTAL_CONDITIONS_PT:
10313 
10314  /*--- Retrieve the specified total conditions for this boundary. ---*/
10315  if (gravity) P_Total = config->GetRiemann_Var1(Marker_Tag) - geometry->node[iPoint]->GetCoord(nDim-1)*STANDARD_GRAVITY;
10316  else P_Total = config->GetRiemann_Var1(Marker_Tag);
10317  T_Total = config->GetRiemann_Var2(Marker_Tag);
10318  Flow_Dir = config->GetRiemann_FlowDir(Marker_Tag);
10319 
10320  /*--- Non-dim. the inputs if necessary. ---*/
10321  P_Total /= config->GetPressure_Ref();
10322  T_Total /= config->GetTemperature_Ref();
10323 
10324  /* --- Computes the total state --- */
10325  FluidModel->SetTDState_PT(P_Total, T_Total);
10327  Entropy_e = FluidModel->GetEntropy();
10328 
10329  /* --- Compute the boundary state u_e --- */
10330  Velocity2_e = Velocity2_i;
10331  for (iDim = 0; iDim < nDim; iDim++)
10332  turboVelocity[iDim] = sqrt(Velocity2_e)*Flow_Dir[iDim];
10333  ComputeBackVelocity(turboVelocity,turboNormal, Velocity_e, config->GetMarker_All_TurbomachineryFlag(val_marker),config->GetKind_TurboMachinery(iZone));
10334  StaticEnthalpy_e = Enthalpy_e - 0.5 * Velocity2_e;
10335  FluidModel->SetTDState_hs(StaticEnthalpy_e, Entropy_e);
10336  Density_e = FluidModel->GetDensity();
10337  StaticEnergy_e = FluidModel->GetStaticEnergy();
10338  Energy_e = StaticEnergy_e + 0.5 * Velocity2_e;
10339  if (tkeNeeded) Energy_e += GetTke_Inf();
10340  break;
10341 
10342  case MIXING_IN:
10343 
10344  /* --- compute total averaged quantities ---*/
10345  FluidModel->SetTDState_Prho(ExtAveragePressure[val_marker][iSpan], ExtAverageDensity[val_marker][iSpan]);
10346  AverageEnthalpy = FluidModel->GetStaticEnergy() + ExtAveragePressure[val_marker][iSpan]/ExtAverageDensity[val_marker][iSpan];
10347  AverageEntropy = FluidModel->GetEntropy();
10348 
10349  FlowDirMixMag = 0;
10350  for (iDim = 0; iDim < nDim; iDim++)
10351  FlowDirMixMag += ExtAverageTurboVelocity[val_marker][iSpan][iDim]*ExtAverageTurboVelocity[val_marker][iSpan][iDim];
10352  for (iDim = 0; iDim < nDim; iDim++){
10353  FlowDirMix[iDim] = ExtAverageTurboVelocity[val_marker][iSpan][iDim]/sqrt(FlowDirMixMag);
10354  }
10355 
10356 
10357  /* --- Computes the total state --- */
10358  Enthalpy_e = AverageEnthalpy;
10359  Entropy_e = AverageEntropy;
10360 
10361  /* --- Compute the boundary state u_e --- */
10362  Velocity2_e = Velocity2_i;
10363  for (iDim = 0; iDim < nDim; iDim++){
10364  turboVelocity[iDim] = sqrt(Velocity2_e)*FlowDirMix[iDim];
10365 
10366  }
10367  ComputeBackVelocity(turboVelocity,turboNormal, Velocity_e, config->GetMarker_All_TurbomachineryFlag(val_marker),config->GetKind_TurboMachinery(iZone));
10368 
10369  StaticEnthalpy_e = Enthalpy_e - 0.5 * Velocity2_e;
10370  FluidModel->SetTDState_hs(StaticEnthalpy_e, Entropy_e);
10371  Density_e = FluidModel->GetDensity();
10372  StaticEnergy_e = FluidModel->GetStaticEnergy();
10373  Energy_e = StaticEnergy_e + 0.5 * Velocity2_e;
10374  // if (tkeNeeded) Energy_e += GetTke_Inf();
10375  break;
10376 
10377 
10378  case MIXING_OUT:
10379 
10380  /*--- Retrieve the staic pressure for this boundary. ---*/
10381  Pressure_e = ExtAveragePressure[val_marker][iSpan];
10382  Density_e = Density_i;
10383 
10384  /* --- Compute the boundary state u_e --- */
10385  FluidModel->SetTDState_Prho(Pressure_e, Density_e);
10386  Velocity2_e = 0.0;
10387  for (iDim = 0; iDim < nDim; iDim++) {
10388  Velocity_e[iDim] = Velocity_i[iDim];
10389  Velocity2_e += Velocity_e[iDim]*Velocity_e[iDim];
10390  }
10391  Energy_e = FluidModel->GetStaticEnergy() + 0.5*Velocity2_e;
10392  break;
10393 
10394  case STATIC_PRESSURE:
10395 
10396  /*--- Retrieve the staic pressure for this boundary. ---*/
10397  Pressure_e = config->GetRiemann_Var1(Marker_Tag);
10398  Pressure_e /= config->GetPressure_Ref();
10399  Density_e = Density_i;
10400 
10401  /* --- Compute the boundary state u_e --- */
10402  FluidModel->SetTDState_Prho(Pressure_e, Density_e);
10403  Velocity2_e = 0.0;
10404  for (iDim = 0; iDim < nDim; iDim++) {
10405  Velocity_e[iDim] = Velocity_i[iDim];
10406  Velocity2_e += Velocity_e[iDim]*Velocity_e[iDim];
10407  }
10408  Energy_e = FluidModel->GetStaticEnergy() + 0.5*Velocity2_e;
10409  break;
10410 
10411 
10412  case RADIAL_EQUILIBRIUM:
10413 
10414  /*--- Retrieve the staic pressure for this boundary. ---*/
10415  Pressure_e = RadialEquilibriumPressure[val_marker][iSpan];
10416  Density_e = Density_i;
10417 
10418  /* --- Compute the boundary state u_e --- */
10419  FluidModel->SetTDState_Prho(Pressure_e, Density_e);
10420  Velocity2_e = 0.0;
10421  for (iDim = 0; iDim < nDim; iDim++) {
10422  Velocity_e[iDim] = Velocity_i[iDim];
10423  Velocity2_e += Velocity_e[iDim]*Velocity_e[iDim];
10424  }
10425  Energy_e = FluidModel->GetStaticEnergy() + 0.5*Velocity2_e;
10426  break;
10427 
10428  default:
10429  SU2_MPI::Error("Invalid Riemann input!", CURRENT_FUNCTION);
10430  break;
10431  }
10432 
10433  /*--- Compute P (matrix of right eigenvectors) ---*/
10434  conv_numerics->GetPMatrix(&Density_i, Velocity_i, &SoundSpeed_i, &Enthalpy_i, &Chi_i, &Kappa_i, UnitNormal, P_Tensor);
10435 
10436  /*--- Compute inverse P (matrix of left eigenvectors)---*/
10437  conv_numerics->GetPMatrix_inv(invP_Tensor, &Density_i, Velocity_i, &SoundSpeed_i, &Chi_i, &Kappa_i, UnitNormal);
10438 
10439  /*--- eigenvalues contribution due to grid motion ---*/
10440  if (grid_movement){
10441  gridVel = geometry->node[iPoint]->GetGridVel();
10442 
10443  su2double ProjGridVel = 0.0;
10444  for (iDim = 0; iDim < nDim; iDim++)
10445  ProjGridVel += gridVel[iDim]*UnitNormal[iDim];
10446  ProjVelocity_i -= ProjGridVel;
10447  }
10448 
10449  /*--- Flow eigenvalues ---*/
10450  for (iDim = 0; iDim < nDim; iDim++)
10451  Lambda_i[iDim] = ProjVelocity_i;
10452  Lambda_i[nVar-2] = ProjVelocity_i + SoundSpeed_i;
10453  Lambda_i[nVar-1] = ProjVelocity_i - SoundSpeed_i;
10454 
10455  /* --- Compute the boundary state u_e --- */
10456  u_e[0] = Density_e;
10457  for (iDim = 0; iDim < nDim; iDim++)
10458  u_e[iDim+1] = Velocity_e[iDim]*Density_e;
10459  u_e[nVar-1] = Energy_e*Density_e;
10460 
10461  /* --- Compute the boundary state u_i --- */
10462  u_i[0] = Density_i;
10463  for (iDim = 0; iDim < nDim; iDim++)
10464  u_i[iDim+1] = Velocity_i[iDim]*Density_i;
10465  u_i[nVar-1] = Energy_i*Density_i;
10466 
10467  /*--- Compute the characteristic jumps ---*/
10468  for (iVar = 0; iVar < nVar; iVar++)
10469  {
10470  dw[iVar] = 0;
10471  for (jVar = 0; jVar < nVar; jVar++)
10472  dw[iVar] += invP_Tensor[iVar][jVar] * (u_e[jVar] - u_i[jVar]);
10473 
10474  }
10475 
10476  /*--- Compute the boundary state u_b using characteristics ---*/
10477  for (iVar = 0; iVar < nVar; iVar++)
10478  {
10479  u_b[iVar] = u_i[iVar];
10480 
10481  for (jVar = 0; jVar < nVar; jVar++)
10482  {
10483  if (Lambda_i[jVar] < 0)
10484  {
10485  u_b[iVar] += P_Tensor[iVar][jVar]*dw[jVar];
10486 
10487  }
10488  }
10489  }
10490 
10491 
10492  /*--- Compute the thermodynamic state in u_b ---*/
10493  Density_b = u_b[0];
10494  Velocity2_b = 0;
10495  for (iDim = 0; iDim < nDim; iDim++)
10496  {
10497  Velocity_b[iDim] = u_b[iDim+1]/Density_b;
10498  Velocity2_b += Velocity_b[iDim]*Velocity_b[iDim];
10499  }
10500  Energy_b = u_b[nVar-1]/Density_b;
10501  StaticEnergy_b = Energy_b - 0.5*Velocity2_b;
10502  FluidModel->SetTDState_rhoe(Density_b, StaticEnergy_b);
10503  Pressure_b = FluidModel->GetPressure();
10504  Temperature_b = FluidModel->GetTemperature();
10505  Enthalpy_b = Energy_b + Pressure_b/Density_b;
10506  Kappa_b = FluidModel->GetdPde_rho() / Density_b;
10507  Chi_b = FluidModel->GetdPdrho_e() - Kappa_b * StaticEnergy_b;
10508 
10509  /*--- Compute the residuals ---*/
10510  conv_numerics->GetInviscidProjFlux(&Density_b, Velocity_b, &Pressure_b, &Enthalpy_b, Normal, Residual);
10511 
10512  /*--- Residual contribution due to grid motion ---*/
10513  if (grid_movement) {
10514  gridVel = geometry->node[iPoint]->GetGridVel();
10515  su2double projVelocity = 0.0;
10516 
10517  for (iDim = 0; iDim < nDim; iDim++)
10518  projVelocity += gridVel[iDim]*Normal[iDim];
10519  for (iVar = 0; iVar < nVar; iVar++)
10520  Residual[iVar] -= projVelocity *(u_b[iVar]);
10521  }
10522 
10523  if (implicit) {
10524 
10525  Jacobian_b = new su2double*[nVar];
10526  DubDu = new su2double*[nVar];
10527  for (iVar = 0; iVar < nVar; iVar++)
10528  {
10529  Jacobian_b[iVar] = new su2double[nVar];
10530  DubDu[iVar] = new su2double[nVar];
10531  }
10532 
10533  /*--- Initialize DubDu to unit matrix---*/
10534 
10535  for (iVar = 0; iVar < nVar; iVar++)
10536  {
10537  for (jVar = 0; jVar < nVar; jVar++)
10538  DubDu[iVar][jVar]= 0;
10539 
10540  DubDu[iVar][iVar]= 1;
10541  }
10542 
10543  /*--- Compute DubDu -= RNL---*/
10544  for (iVar=0; iVar<nVar; iVar++)
10545  {
10546  for (jVar=0; jVar<nVar; jVar++)
10547  {
10548  for (kVar=0; kVar<nVar; kVar++)
10549  {
10550  if (Lambda_i[kVar]<0)
10551  DubDu[iVar][jVar] -= P_Tensor[iVar][kVar] * invP_Tensor[kVar][jVar];
10552  }
10553  }
10554  }
10555 
10556  /*--- Compute flux Jacobian in state b ---*/
10557  conv_numerics->GetInviscidProjJac(Velocity_b, &Enthalpy_b, &Chi_b, &Kappa_b, Normal, 1.0, Jacobian_b);
10558 
10559  /*--- Jacobian contribution due to grid motion ---*/
10560  if (grid_movement)
10561  {
10562  gridVel = geometry->node[iPoint]->GetGridVel();
10563  su2double projVelocity = 0.0;
10564  for (iDim = 0; iDim < nDim; iDim++)
10565  projVelocity += gridVel[iDim]*Normal[iDim];
10566  for (iVar = 0; iVar < nVar; iVar++){
10567  Residual[iVar] -= projVelocity *(u_b[iVar]);
10568  Jacobian_b[iVar][iVar] -= projVelocity;
10569  }
10570 
10571  }
10572 
10573  /*--- initiate Jacobian_i to zero matrix ---*/
10574  for (iVar=0; iVar<nVar; iVar++)
10575  for (jVar=0; jVar<nVar; jVar++)
10576  Jacobian_i[iVar][jVar] = 0.0;
10577 
10578  /*--- Compute numerical flux Jacobian at node i ---*/
10579  for (iVar=0; iVar<nVar; iVar++) {
10580  for (jVar=0; jVar<nVar; jVar++) {
10581  for (kVar=0; kVar<nVar; kVar++) {
10582  Jacobian_i[iVar][jVar] += Jacobian_b[iVar][kVar] * DubDu[kVar][jVar];
10583  }
10584  }
10585  }
10586 
10587  for (iVar = 0; iVar < nVar; iVar++) {
10588  delete [] Jacobian_b[iVar];
10589  delete [] DubDu[iVar];
10590  }
10591  delete [] Jacobian_b;
10592  delete [] DubDu;
10593  }
10594 
10595  /*--- Update residual value ---*/
10596  LinSysRes.AddBlock(iPoint, Residual);
10597 
10598  /*--- Jacobian contribution for implicit integration ---*/
10599  if (implicit)
10600  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
10601 
10602  /*--- Roe Turkel preconditioning, set the value of beta ---*/
10603  if (config->GetKind_Upwind() == TURKEL)
10604  node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta());
10605 
10606  /*--- Viscous contribution ---*/
10607 
10608  if (viscous) {
10609 
10610  /*--- Primitive variables, using the derived quantities ---*/
10611 
10612  V_boundary[0] = Temperature_b;
10613  for (iDim = 0; iDim < nDim; iDim++)
10614  V_boundary[iDim+1] = Velocity_b[iDim];
10615  V_boundary[nDim+1] = Pressure_b;
10616  V_boundary[nDim+2] = Density_b;
10617  V_boundary[nDim+3] = Enthalpy_b;
10618 
10619  /*--- Set laminar and eddy viscosity at the infinity ---*/
10620 
10621  V_boundary[nDim+5] = FluidModel->GetLaminarViscosity();
10622  V_boundary[nDim+6] = node[iPoint]->GetEddyViscosity();
10623  V_boundary[nDim+7] = FluidModel->GetThermalConductivity();
10624  V_boundary[nDim+8] = FluidModel->GetCp();
10625 
10626  /*--- Set the normal vector and the coordinates ---*/
10627 
10628  visc_numerics->SetNormal(Normal);
10629  visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
10630 
10631  /*--- Primitive variables, and gradient ---*/
10632 
10633  visc_numerics->SetPrimitive(V_domain, V_boundary);
10634  visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
10635 
10636  /*--- Secondary variables ---*/
10637 
10638  S_domain = node[iPoint]->GetSecondary();
10639 
10640  /*--- Compute secondary thermodynamic properties (partial derivatives...) ---*/
10641 
10642  S_boundary[0]= FluidModel->GetdPdrho_e();
10643  S_boundary[1]= FluidModel->GetdPde_rho();
10644 
10645  S_boundary[2]= FluidModel->GetdTdrho_e();
10646  S_boundary[3]= FluidModel->GetdTde_rho();
10647 
10648  /*--- Compute secondary thermo-physical properties (partial derivatives...) ---*/
10649 
10650  S_boundary[4]= FluidModel->Getdmudrho_T();
10651  S_boundary[5]= FluidModel->GetdmudT_rho();
10652 
10653  S_boundary[6]= FluidModel->Getdktdrho_T();
10654  S_boundary[7]= FluidModel->GetdktdT_rho();
10655 
10656  visc_numerics->SetSecondary(S_domain, S_boundary);
10657 
10658  /*--- Turbulent kinetic energy ---*/
10659 
10660  if (config->GetKind_Turb_Model() == SST)
10661  visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
10662 
10663  /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
10664 
10665  visc_numerics->SetTauWall(-1.0, -1.0);
10666 
10667  /*--- Compute and update residual ---*/
10668 
10669  visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
10670  LinSysRes.SubtractBlock(iPoint, Residual);
10671 
10672  /*--- Jacobian contribution for implicit integration ---*/
10673 
10674  if (implicit)
10675  Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
10676 
10677  }
10678  }
10679  }
10680 }
10681 
10682  /*--- Free locally allocated memory ---*/
10683  delete [] Normal;
10684  delete [] UnitNormal;
10685  delete [] turboNormal;
10686  delete [] turboVelocity;
10687  delete [] Velocity_e;
10688  delete [] Velocity_b;
10689  delete [] Velocity_i;
10690  delete [] FlowDirMix;
10691 
10692  delete [] S_boundary;
10693  delete [] Lambda_i;
10694  delete [] u_i;
10695  delete [] u_e;
10696  delete [] u_b;
10697  delete [] dw;
10698 
10699 
10700  for (iVar = 0; iVar < nVar; iVar++)
10701  {
10702  delete [] P_Tensor[iVar];
10703  delete [] invP_Tensor[iVar];
10704  }
10705  delete [] P_Tensor;
10706  delete [] invP_Tensor;
10707 
10708 }
10709 
10710 void CEulerSolver::PreprocessBC_Giles(CGeometry *geometry, CConfig *config, CNumerics *conv_numerics, unsigned short marker_flag) {
10711  /* Implementation of Fuorier Transformations for non-regfelcting BC will come soon */
10712  su2double cj_inf,cj_out1, cj_out2, Density_i, Pressure_i, *turboNormal, *turboVelocity, *Velocity_i, AverageSoundSpeed;
10713  su2double *deltaprim, *cj, TwoPiThetaFreq_Pitch, pitch, theta, deltaTheta;
10714  unsigned short iMarker, iSpan, iMarkerTP, iDim;
10715  unsigned long iPoint, kend_max, k;
10716  long iVertex, freq;
10717  unsigned short iZone = config->GetiZone();
10718  unsigned short nSpanWiseSections = geometry->GetnSpanWiseSections(marker_flag);
10719  turboNormal = new su2double[nDim];
10720  turboVelocity = new su2double[nDim];
10721  Velocity_i = new su2double[nDim];
10722  deltaprim = new su2double[nVar];
10723  cj = new su2double[nVar];
10724  complex<su2double> I, cktemp_inf,cktemp_out1, cktemp_out2, expArg;
10725  I = complex<su2double>(0.0,1.0);
10726 
10727 #ifdef HAVE_MPI
10728  su2double MyIm_inf, MyRe_inf, Im_inf, Re_inf, MyIm_out1, MyRe_out1, Im_out1, Re_out1, MyIm_out2, MyRe_out2, Im_out2, Re_out2;
10729 #endif
10730 
10731  kend_max = geometry->GetnFreqSpanMax(marker_flag);
10732  for (iSpan= 0; iSpan < nSpanWiseSections ; iSpan++){
10733  for(k=0; k < 2*kend_max+1; k++){
10734  freq = k - kend_max;
10735  cktemp_inf = complex<su2double>(0.0,0.0);
10736  cktemp_out1 = complex<su2double>(0.0,0.0);
10737  cktemp_out2 = complex<su2double>(0.0,0.0);
10738  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++){
10739  for (iMarkerTP=1; iMarkerTP < config->GetnMarker_Turbomachinery()+1; iMarkerTP++){
10740  if (config->GetMarker_All_Turbomachinery(iMarker) == iMarkerTP){
10741  if (config->GetMarker_All_TurbomachineryFlag(iMarker) == marker_flag){
10742  for (iVertex = 0; iVertex < geometry->nVertexSpan[iMarker][iSpan]; iVertex++) {
10743 
10744  /*--- find the node related to the vertex ---*/
10745  iPoint = geometry->turbovertex[iMarker][iSpan][iVertex]->GetNode();
10746 
10747  geometry->turbovertex[iMarker][iSpan][iVertex]->GetTurboNormal(turboNormal);
10748  /*--- Compute the internal state _i ---*/
10749 
10750  Pressure_i = node[iPoint]->GetPressure();
10751  Density_i = node[iPoint]->GetDensity();
10752  for (iDim = 0; iDim < nDim; iDim++)
10753  {
10754  Velocity_i[iDim] = node[iPoint]->GetVelocity(iDim);
10755  }
10756  ComputeTurboVelocity(Velocity_i, turboNormal, turboVelocity, marker_flag, config->GetKind_TurboMachinery(iZone));
10757 
10758  if(nDim ==2){
10759  deltaprim[0] = Density_i - AverageDensity[iMarker][iSpan];
10760  deltaprim[1] = turboVelocity[0] - AverageTurboVelocity[iMarker][iSpan][0];
10761  deltaprim[2] = turboVelocity[1] - AverageTurboVelocity[iMarker][iSpan][1];
10762  deltaprim[3] = Pressure_i - AveragePressure[iMarker][iSpan];
10763  }
10764  else{
10765  //Here 3d
10766  deltaprim[0] = Density_i - AverageDensity[iMarker][iSpan];
10767  deltaprim[1] = turboVelocity[0] - AverageTurboVelocity[iMarker][iSpan][0];
10768  deltaprim[2] = turboVelocity[1] - AverageTurboVelocity[iMarker][iSpan][1];
10769  deltaprim[3] = turboVelocity[2] - AverageTurboVelocity[iMarker][iSpan][2]; //New char
10770  deltaprim[4] = Pressure_i - AveragePressure[iMarker][iSpan];
10771  }
10772 
10773  FluidModel->SetTDState_Prho(AveragePressure[iMarker][iSpan], AverageDensity[iMarker][iSpan]);
10774  AverageSoundSpeed = FluidModel->GetSoundSpeed();
10775  conv_numerics->GetCharJump(AverageSoundSpeed, AverageDensity[iMarker][iSpan], deltaprim, cj);
10776 
10777  /*-----this is only valid 2D ----*/
10778  if(nDim ==2){
10779  cj_out1 = cj[1];
10780  cj_out2 = cj[2];
10781  cj_inf = cj[3];
10782  }
10783  else{
10784  //Here 3D
10785  cj_out1 = cj[1];
10786  cj_out2 = cj[3];
10787  cj_inf = cj[4];
10788  }
10789  pitch = geometry->GetMaxAngularCoord(iMarker, iSpan) - geometry->GetMinAngularCoord(iMarker,iSpan);
10790  theta = geometry->turbovertex[iMarker][iSpan][iVertex]->GetRelAngularCoord();
10791  deltaTheta = geometry->turbovertex[iMarker][iSpan][iVertex]->GetDeltaAngularCoord();
10792  TwoPiThetaFreq_Pitch = 2*PI_NUMBER*freq*theta/pitch;
10793 
10794  expArg = complex<su2double>(cos(TwoPiThetaFreq_Pitch)) - I*complex<su2double>(sin(TwoPiThetaFreq_Pitch));
10795  if (freq != 0){
10796  cktemp_out1 += cj_out1*expArg*deltaTheta/pitch;
10797  cktemp_out2 += cj_out2*expArg*deltaTheta/pitch;
10798  cktemp_inf += cj_inf*expArg*deltaTheta/pitch;
10799  }
10800  else{
10801  cktemp_inf += complex<su2double>(0.0,0.0);
10802  cktemp_out1 += complex<su2double>(0.0,0.0);
10803  cktemp_out2 += complex<su2double>(0.0,0.0);
10804  }
10805  }
10806 
10807  }
10808  }
10809  }
10810  }
10811 
10812 #ifdef HAVE_MPI
10813  MyRe_inf = cktemp_inf.real(); Re_inf = 0.0;
10814  MyIm_inf = cktemp_inf.imag(); Im_inf = 0.0;
10815  cktemp_inf = complex<su2double>(0.0,0.0);
10816 
10817  MyRe_out1 = cktemp_out1.real(); Re_out1 = 0.0;
10818  MyIm_out1 = cktemp_out1.imag(); Im_out1 = 0.0;
10819  cktemp_out1 = complex<su2double>(0.0,0.0);
10820 
10821  MyRe_out2 = cktemp_out2.real(); Re_out2 = 0.0;
10822  MyIm_out2 = cktemp_out2.imag(); Im_out2 = 0.0;
10823  cktemp_out2 = complex<su2double>(0.0,0.0);
10824 
10825 
10826  SU2_MPI::Allreduce(&MyRe_inf, &Re_inf, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
10827  SU2_MPI::Allreduce(&MyIm_inf, &Im_inf, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
10828  SU2_MPI::Allreduce(&MyRe_out1, &Re_out1, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
10829  SU2_MPI::Allreduce(&MyIm_out1, &Im_out1, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
10830  SU2_MPI::Allreduce(&MyRe_out2, &Re_out2, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
10831  SU2_MPI::Allreduce(&MyIm_out2, &Im_out2, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
10832 
10833  cktemp_inf = complex<su2double>(Re_inf,Im_inf);
10834  cktemp_out1 = complex<su2double>(Re_out1,Im_out1);
10835  cktemp_out2 = complex<su2double>(Re_out2,Im_out2);
10836 
10837 #endif
10838 
10839  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++){
10840  for (iMarkerTP=1; iMarkerTP < config->GetnMarker_Turbomachinery()+1; iMarkerTP++){
10841  if (config->GetMarker_All_Turbomachinery(iMarker) == iMarkerTP){
10842  if (config->GetMarker_All_TurbomachineryFlag(iMarker) == marker_flag){
10843  /*-----this is only valid 2D ----*/
10844  if (marker_flag == INFLOW){
10845  CkInflow[iMarker][iSpan][k]= cktemp_inf;
10846  }else{
10847  CkOutflow1[iMarker][iSpan][k]=cktemp_out1;
10848  CkOutflow2[iMarker][iSpan][k]=cktemp_out2;
10849  }
10850  }
10851  }
10852  }
10853  }
10854  }
10855  }
10856 
10857  delete [] turboVelocity;
10858  delete [] turboNormal;
10859  delete [] Velocity_i;
10860  delete [] deltaprim;
10861  delete [] cj;
10862 
10863 }
10864 
10865 void CEulerSolver::BC_Giles(CGeometry *geometry, CSolver **solver_container,
10866  CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
10867  unsigned short iDim, iVar, jVar, iSpan;
10868  unsigned long iPoint, Point_Normal, oldVertex, k, kend, kend_max;
10869  long iVertex;
10870  su2double *UnitNormal, *turboVelocity, *turboNormal;
10871 
10872  su2double *Velocity_b, Velocity2_b, Enthalpy_b, Energy_b, Density_b, Pressure_b, Temperature_b;
10873  su2double *Velocity_i, Velocity2_i, Energy_i, StaticEnergy_i, Density_i, Pressure_i;
10874  su2double Pressure_e;
10875  su2double *V_boundary, *V_domain, *S_boundary, *S_domain;
10876  unsigned short iZone = config->GetiZone();
10877  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
10878  bool grid_movement = config->GetGrid_Movement();
10879  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
10880  bool viscous = config->GetViscous();
10881  unsigned short nSpanWiseSections = geometry->GetnSpanWiseSections(config->GetMarker_All_TurbomachineryFlag(val_marker));
10882  su2double relfacAvgCfg = config->GetGiles_RelaxFactorAverage(Marker_Tag);
10883  su2double relfacFouCfg = config->GetGiles_RelaxFactorFourier(Marker_Tag);
10884  su2double *Normal;
10885  su2double TwoPiThetaFreq_Pitch, pitch,theta;
10886  su2double *SpanWiseValues = NULL;
10887  su2double spanPercent, extrarelfacAvg = 0.0, deltaSpan = 0.0, relfacAvg, relfacFou, coeffrelfacAvg = 0.0;
10888  unsigned short Turbo_Flag;
10889 
10890  Normal = new su2double[nDim];
10891  turboNormal = new su2double[nDim];
10892  UnitNormal = new su2double[nDim];
10893  turboVelocity = new su2double[nDim];
10894  Velocity_i = new su2double[nDim];
10895  Velocity_b = new su2double[nDim];
10896 
10897 
10898  su2double AverageSoundSpeed, *AverageTurboMach, AverageEntropy, AverageEnthalpy;
10899  AverageTurboMach = new su2double[nDim];
10900  S_boundary = new su2double[8];
10901 
10902  su2double AvgMach , *cj, GilesBeta, *delta_c, **R_Matrix, *deltaprim, **R_c_inv,**R_c, alphaIn_BC, gammaIn_BC = 0,
10903  P_Total, T_Total, *FlowDir, Enthalpy_BC, Entropy_BC, *R, *c_avg,*dcjs, Beta_inf2, c2js_Re, c3js_Re, cOutjs_Re, avgVel2 =0.0;
10904 
10905  long freq;
10906 
10907  delta_c = new su2double[nVar];
10908  deltaprim = new su2double[nVar];
10909  cj = new su2double[nVar];
10910  R_Matrix = new su2double*[nVar];
10911  R_c = new su2double*[nVar-1];
10912  R_c_inv = new su2double*[nVar-1];
10913  R = new su2double[nVar-1];
10914  c_avg = new su2double[nVar];
10915  dcjs = new su2double[nVar];
10916 
10917  for (iVar = 0; iVar < nVar; iVar++)
10918  {
10919  R_Matrix[iVar] = new su2double[nVar];
10920  c_avg[iVar] = 0.0;
10921  dcjs[iVar] = 0.0;
10922  }
10923  for (iVar = 0; iVar < nVar-1; iVar++)
10924  {
10925  R_c[iVar] = new su2double[nVar-1];
10926  R_c_inv[iVar] = new su2double[nVar-1];
10927  }
10928 
10929 
10930  complex<su2double> I, c2ks, c2js, c3ks, c3js, c4ks, c4js, cOutks, cOutjs, Beta_inf;
10931  I = complex<su2double>(0.0,1.0);
10932 
10933  /*--- Compute coeff for under relaxation of Avg and Fourier Coefficient for hub and shroud---*/
10934  if (nDim == 3){
10935  extrarelfacAvg = config->GetExtraRelFacGiles(0);
10936  spanPercent = config->GetExtraRelFacGiles(1);
10937  Turbo_Flag = config->GetMarker_All_TurbomachineryFlag(val_marker);
10938  SpanWiseValues = geometry->GetSpanWiseValue(Turbo_Flag);
10939  deltaSpan = SpanWiseValues[nSpanWiseSections-1]*spanPercent;
10940  coeffrelfacAvg = (relfacAvgCfg - extrarelfacAvg)/deltaSpan;
10941  }
10942 
10943  for (iSpan= 0; iSpan < nSpanWiseSections ; iSpan++){
10944  /*--- Compute under relaxation for the Hub and Shroud Avg and Fourier Coefficient---*/
10945  if(nDim == 3){
10946  if(SpanWiseValues[iSpan] <= SpanWiseValues[0] + deltaSpan){
10947  relfacAvg = extrarelfacAvg + coeffrelfacAvg*(SpanWiseValues[iSpan] - SpanWiseValues[0]);
10948  relfacFou = 0.0;
10949  }
10950  else if(SpanWiseValues[iSpan] >= SpanWiseValues[nSpanWiseSections -1] - deltaSpan){
10951  relfacAvg = extrarelfacAvg - coeffrelfacAvg*(SpanWiseValues[iSpan] - SpanWiseValues[nSpanWiseSections -1]);
10952  relfacFou = 0.0;
10953  }
10954  else{
10955  relfacAvg = relfacAvgCfg;
10956  relfacFou = relfacFouCfg;
10957  }
10958  }
10959  else{
10960  {
10961  relfacAvg = relfacAvgCfg;
10962  relfacFou = relfacFouCfg;
10963  }
10964  }
10965 
10966  FluidModel->SetTDState_Prho(AveragePressure[val_marker][iSpan], AverageDensity[val_marker][iSpan]);
10967  AverageSoundSpeed = FluidModel->GetSoundSpeed();
10968  AverageTurboMach[0] = AverageTurboVelocity[val_marker][iSpan][0]/AverageSoundSpeed;
10969  AverageTurboMach[1] = AverageTurboVelocity[val_marker][iSpan][1]/AverageSoundSpeed;
10970 
10971  if(grid_movement){
10972  AverageTurboMach[1] -= geometry->GetAverageTangGridVel(val_marker,iSpan)/AverageSoundSpeed;
10973  }
10974 
10975  AvgMach = AverageTurboMach[0]*AverageTurboMach[0] + AverageTurboMach[1]*AverageTurboMach[1];
10976 
10977  kend = geometry->GetnFreqSpan(val_marker, iSpan);
10978  kend_max = geometry->GetnFreqSpanMax(config->GetMarker_All_TurbomachineryFlag(val_marker));
10979  conv_numerics->GetRMatrix(AverageSoundSpeed, AverageDensity[val_marker][iSpan], R_Matrix);
10980 
10981  switch(config->GetKind_Data_Giles(Marker_Tag)){
10982 
10983  case TOTAL_CONDITIONS_PT:
10984 
10985  /*--- Retrieve the specified total conditions for this inlet. ---*/
10986  P_Total = config->GetGiles_Var1(Marker_Tag);
10987  T_Total = config->GetGiles_Var2(Marker_Tag);
10988  FlowDir = config->GetGiles_FlowDir(Marker_Tag);
10989  alphaIn_BC = atan(FlowDir[1]/FlowDir[0]);
10990 
10991  gammaIn_BC = 0;
10992  if (nDim == 3){
10993  gammaIn_BC = FlowDir[2]; //atan(FlowDir[2]/FlowDir[0]);
10994  }
10995 
10996  /*--- Non-dim. the inputs---*/
10997  P_Total /= config->GetPressure_Ref();
10998  T_Total /= config->GetTemperature_Ref();
10999 
11000  /* --- Computes the total state --- */
11001  FluidModel->SetTDState_PT(P_Total, T_Total);
11003  Entropy_BC = FluidModel->GetEntropy();
11004 
11005 
11006  /* --- Computes the inverse matrix R_c --- */
11007  conv_numerics->ComputeResJacobianGiles(FluidModel, AveragePressure[val_marker][iSpan], AverageDensity[val_marker][iSpan], AverageTurboVelocity[val_marker][iSpan], alphaIn_BC, gammaIn_BC, R_c, R_c_inv);
11008 
11009  FluidModel->SetTDState_Prho(AveragePressure[val_marker][iSpan], AverageDensity[val_marker][iSpan]);
11010  AverageEnthalpy = FluidModel->GetStaticEnergy() + AveragePressure[val_marker][iSpan]/AverageDensity[val_marker][iSpan];
11011  AverageEntropy = FluidModel->GetEntropy();
11012 
11013  avgVel2 = 0.0;
11014  for (iDim = 0; iDim < nDim; iDim++) avgVel2 += AverageVelocity[val_marker][iSpan][iDim]*AverageVelocity[val_marker][iSpan][iDim];
11015  if (nDim == 2){
11016  R[0] = -(AverageEntropy - Entropy_BC);
11017  R[1] = -(AverageTurboVelocity[val_marker][iSpan][1] - tan(alphaIn_BC)*AverageTurboVelocity[val_marker][iSpan][0]);
11018  R[2] = -(AverageEnthalpy + 0.5*avgVel2 - Enthalpy_BC);
11019  }
11020 
11021  else{
11022  R[0] = -(AverageEntropy - Entropy_BC);
11023  R[1] = -(AverageTurboVelocity[val_marker][iSpan][1] - tan(alphaIn_BC)*AverageTurboVelocity[val_marker][iSpan][0]);
11024  R[2] = -(AverageTurboVelocity[val_marker][iSpan][2] - tan(gammaIn_BC)*AverageTurboVelocity[val_marker][iSpan][0]);
11025  R[3] = -(AverageEnthalpy + 0.5*avgVel2 - Enthalpy_BC);
11026 
11027  }
11028  /* --- Compute the avg component c_avg = R_c^-1 * R --- */
11029  for (iVar = 0; iVar < nVar-1; iVar++){
11030  c_avg[iVar] = 0.0;
11031  for (jVar = 0; jVar < nVar-1; jVar++){
11032  c_avg[iVar] += R_c_inv[iVar][jVar]*R[jVar];
11033  }
11034  }
11035  break;
11036 
11038 
11039  /*--- Retrieve the specified total conditions for this inlet. ---*/
11040  P_Total = config->GetGiles_Var1(Marker_Tag);
11041  T_Total = config->GetGiles_Var2(Marker_Tag);
11042  FlowDir = config->GetGiles_FlowDir(Marker_Tag);
11043  alphaIn_BC = atan(FlowDir[1]/FlowDir[0]);
11044 
11045  gammaIn_BC = 0;
11046  if (nDim == 3){
11047  // Review definition of angle
11048  gammaIn_BC = FlowDir[2]; //atan(FlowDir[2]/FlowDir[0]);
11049  }
11050 
11051  /*--- Non-dim. the inputs---*/
11052  P_Total /= config->GetPressure_Ref();
11053  T_Total /= config->GetTemperature_Ref();
11054 
11055  /* --- Computes the total state --- */
11056  FluidModel->SetTDState_PT(P_Total, T_Total);
11058  Entropy_BC = FluidModel->GetEntropy();
11059 
11060 
11061  /* --- Computes the inverse matrix R_c --- */
11062  conv_numerics->ComputeResJacobianGiles(FluidModel, AveragePressure[val_marker][iSpan], AverageDensity[val_marker][iSpan], AverageTurboVelocity[val_marker][iSpan], alphaIn_BC, gammaIn_BC, R_c, R_c_inv);
11063 
11065  AverageEnthalpy = FluidModel->GetStaticEnergy() + AveragePressure[val_marker][nSpanWiseSections]/AverageDensity[val_marker][nSpanWiseSections];
11066  AverageEntropy = FluidModel->GetEntropy();
11067 
11068 
11069  avgVel2 = 0.0;
11070  for (iDim = 0; iDim < nDim; iDim++) avgVel2 += AverageVelocity[val_marker][iSpan][iDim]*AverageVelocity[val_marker][iSpan][iDim];
11071  if (nDim == 2){
11072  R[0] = -(AverageEntropy - Entropy_BC);
11073  R[1] = -(AverageTurboVelocity[val_marker][nSpanWiseSections][1] - tan(alphaIn_BC)*AverageTurboVelocity[val_marker][nSpanWiseSections][0]);
11074  R[2] = -(AverageEnthalpy + 0.5*avgVel2 - Enthalpy_BC);
11075  }
11076 
11077  else{
11078  R[0] = -(AverageEntropy - Entropy_BC);
11079  R[1] = -(AverageTurboVelocity[val_marker][nSpanWiseSections][1] - tan(alphaIn_BC)*AverageTurboVelocity[val_marker][nSpanWiseSections][0]);
11080  R[2] = -(AverageTurboVelocity[val_marker][nSpanWiseSections][2] - tan(gammaIn_BC)*AverageTurboVelocity[val_marker][nSpanWiseSections][0]);
11081  R[3] = -(AverageEnthalpy + 0.5*avgVel2 - Enthalpy_BC);
11082 
11083  }
11084  /* --- Compute the avg component c_avg = R_c^-1 * R --- */
11085  for (iVar = 0; iVar < nVar-1; iVar++){
11086  c_avg[iVar] = 0.0;
11087  for (jVar = 0; jVar < nVar-1; jVar++){
11088  c_avg[iVar] += R_c_inv[iVar][jVar]*R[jVar];
11089  }
11090  }
11091  break;
11092 
11093  case MIXING_IN: case MIXING_OUT:
11094 
11095  /* --- Compute average jump of primitive at the mixing-plane interface--- */
11096  deltaprim[0] = ExtAverageDensity[val_marker][iSpan] - AverageDensity[val_marker][iSpan];
11097  deltaprim[1] = ExtAverageTurboVelocity[val_marker][iSpan][0] - AverageTurboVelocity[val_marker][iSpan][0];
11098  deltaprim[2] = ExtAverageTurboVelocity[val_marker][iSpan][1] - AverageTurboVelocity[val_marker][iSpan][1];
11099  if (nDim == 2){
11100  deltaprim[3] = ExtAveragePressure[val_marker][iSpan] - AveragePressure[val_marker][iSpan];
11101  }
11102  else
11103  {
11104  deltaprim[3] = ExtAverageTurboVelocity[val_marker][iSpan][2] - AverageTurboVelocity[val_marker][iSpan][2];
11105  deltaprim[4] = ExtAveragePressure[val_marker][iSpan] - AveragePressure[val_marker][iSpan];
11106  }
11107 
11108 
11109  /* --- Compute average jump of charachteristic variable at the mixing-plane interface--- */
11110  FluidModel->SetTDState_Prho(AveragePressure[val_marker][iSpan], AverageDensity[val_marker][iSpan]);
11111  AverageSoundSpeed = FluidModel->GetSoundSpeed();
11112  conv_numerics->GetCharJump(AverageSoundSpeed, AverageDensity[val_marker][iSpan], deltaprim, c_avg);
11113  break;
11114 
11115  case MIXING_IN_1D: case MIXING_OUT_1D:
11116 
11117  /* --- Compute average jump of primitive at the mixing-plane interface--- */
11118  deltaprim[0] = ExtAverageDensity[val_marker][nSpanWiseSections] - AverageDensity[val_marker][nSpanWiseSections];
11119  deltaprim[1] = ExtAverageTurboVelocity[val_marker][nSpanWiseSections][0] - AverageTurboVelocity[val_marker][nSpanWiseSections][0];
11120  deltaprim[2] = ExtAverageTurboVelocity[val_marker][nSpanWiseSections][1] - AverageTurboVelocity[val_marker][nSpanWiseSections][1];
11121  if (nDim == 2){
11122  deltaprim[3] = ExtAveragePressure[val_marker][nSpanWiseSections] - AveragePressure[val_marker][nSpanWiseSections];
11123  }
11124  else
11125  {
11126  deltaprim[3] = ExtAverageTurboVelocity[val_marker][nSpanWiseSections][2] - AverageTurboVelocity[val_marker][nSpanWiseSections][2];
11127  deltaprim[4] = ExtAveragePressure[val_marker][nSpanWiseSections] - AveragePressure[val_marker][nSpanWiseSections];
11128  }
11129 
11130  /* --- Compute average jump of charachteristic variable at the mixing-plane interface--- */
11132  AverageSoundSpeed = FluidModel->GetSoundSpeed();
11133  conv_numerics->GetCharJump(AverageSoundSpeed, AverageDensity[val_marker][nSpanWiseSections], deltaprim, c_avg);
11134  break;
11135 
11136 
11137  case STATIC_PRESSURE:
11138  Pressure_e = config->GetGiles_Var1(Marker_Tag);
11139  Pressure_e /= config->GetPressure_Ref();
11140 
11141  /* --- Compute avg characteristic jump --- */
11142  if (nDim == 2){
11143  c_avg[3] = -2.0*(AveragePressure[val_marker][iSpan]-Pressure_e);
11144  }
11145  else
11146  {
11147  c_avg[4] = -2.0*(AveragePressure[val_marker][iSpan]-Pressure_e);
11148  }
11149  break;
11150 
11151  case STATIC_PRESSURE_1D:
11152  Pressure_e = config->GetGiles_Var1(Marker_Tag);
11153  Pressure_e /= config->GetPressure_Ref();
11154 
11155  /* --- Compute avg characteristic jump --- */
11156  if (nDim == 2){
11157  c_avg[3] = -2.0*(AveragePressure[val_marker][nSpanWiseSections]-Pressure_e);
11158  }
11159  else
11160  {
11161  c_avg[4] = -2.0*(AveragePressure[val_marker][nSpanWiseSections]-Pressure_e);
11162  }
11163  break;
11164 
11165  case RADIAL_EQUILIBRIUM:
11166  Pressure_e = RadialEquilibriumPressure[val_marker][iSpan];
11167 
11168  /* --- Compute avg characteristic jump --- */
11169  c_avg[4] = -2.0*(AveragePressure[val_marker][iSpan]-Pressure_e);
11170 
11171  break;
11172 
11173  }
11174 
11175  /*--- Loop over all the vertices on this boundary marker ---*/
11176 
11177  for (iVertex = 0; iVertex < geometry->nVertexSpan[val_marker][iSpan]; iVertex++) {
11178 
11179  /*--- using the other vertex information for retrieving some information ---*/
11180  oldVertex = geometry->turbovertex[val_marker][iSpan][iVertex]->GetOldVertex();
11181  V_boundary= GetCharacPrimVar(val_marker, oldVertex);
11182 
11183  /*--- Index of the closest interior node ---*/
11184  Point_Normal = geometry->vertex[val_marker][oldVertex]->GetNormal_Neighbor();
11185 
11186  /*--- Normal vector for this vertex (negate for outward convention),
11187  * this normal is scaled with the area of the face of the element ---*/
11188  geometry->vertex[val_marker][oldVertex]->GetNormal(Normal);
11189  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
11190  conv_numerics->SetNormal(Normal);
11191 
11192  /*--- find the node related to the vertex ---*/
11193  iPoint = geometry->turbovertex[val_marker][iSpan][iVertex]->GetNode();
11194 
11195  /*--- Normalize Normal vector for this vertex (already for outward convention) ---*/
11196  geometry->turbovertex[val_marker][iSpan][iVertex]->GetNormal(UnitNormal);
11197  geometry->turbovertex[val_marker][iSpan][iVertex]->GetTurboNormal(turboNormal);
11198 
11199  /*--- Retrieve solution at this boundary node ---*/
11200  V_domain = node[iPoint]->GetPrimitive();
11201 
11202  /*--- Retrieve domain Secondary variables ---*/
11203  S_domain = node[iPoint]->GetSecondary();
11204 
11205 
11206  /*--- Compute the internal state u_i ---*/
11207  Velocity2_i = 0;
11208  for (iDim = 0; iDim < nDim; iDim++)
11209  {
11210  Velocity_i[iDim] = node[iPoint]->GetVelocity(iDim);
11211  Velocity2_i += Velocity_i[iDim]*Velocity_i[iDim];
11212  }
11213 
11214 
11215  Density_i = node[iPoint]->GetDensity();
11216 
11217  Energy_i = node[iPoint]->GetEnergy();
11218  StaticEnergy_i = Energy_i - 0.5*Velocity2_i;
11219 
11220  FluidModel->SetTDState_rhoe(Density_i, StaticEnergy_i);
11221 
11222  Pressure_i = FluidModel->GetPressure();
11223 
11224  ComputeTurboVelocity(Velocity_i, turboNormal, turboVelocity, config->GetMarker_All_TurbomachineryFlag(val_marker),config->GetKind_TurboMachinery(iZone));
11225  if (nDim == 2){
11226  deltaprim[0] = Density_i - AverageDensity[val_marker][iSpan];
11227  deltaprim[1] = turboVelocity[0] - AverageTurboVelocity[val_marker][iSpan][0];
11228  deltaprim[2] = turboVelocity[1] - AverageTurboVelocity[val_marker][iSpan][1];
11229  deltaprim[3] = Pressure_i - AveragePressure[val_marker][iSpan];
11230  }
11231  else{
11232  deltaprim[0] = Density_i - AverageDensity[val_marker][iSpan];
11233  deltaprim[1] = turboVelocity[0] - AverageTurboVelocity[val_marker][iSpan][0];
11234  deltaprim[2] = turboVelocity[1] - AverageTurboVelocity[val_marker][iSpan][1];
11235  deltaprim[3] = turboVelocity[2] - AverageTurboVelocity[val_marker][iSpan][2];
11236  deltaprim[4] = Pressure_i - AveragePressure[val_marker][iSpan];
11237  }
11238 
11239  FluidModel->SetTDState_Prho(AveragePressure[val_marker][iSpan], AverageDensity[val_marker][iSpan]);
11240  AverageSoundSpeed = FluidModel->GetSoundSpeed();
11241  conv_numerics->GetCharJump(AverageSoundSpeed, AverageDensity[val_marker][iSpan], deltaprim, cj);
11242 
11243 
11244  pitch = geometry->GetMaxAngularCoord(val_marker, iSpan) - geometry->GetMinAngularCoord(val_marker,iSpan);
11245  theta = geometry->turbovertex[val_marker][iSpan][iVertex]->GetRelAngularCoord();
11246 
11247  switch(config->GetKind_Data_Giles(Marker_Tag))
11248  {
11249 
11250  //Done, generilize for 3D case
11251  //TODO(turbo), generilize for Inlet and Outlet in for backflow treatment
11252 
11254  if(config->GetSpatialFourier()){
11255  if (AvgMach <= 1.0){
11256  Beta_inf= I*complex<su2double>(sqrt(1.0 - AvgMach));
11257  c2js = complex<su2double>(0.0,0.0);
11258  c3js = complex<su2double>(0.0,0.0);
11259  for(k=0; k < 2*kend_max+1; k++){
11260  freq = k - kend_max;
11261  if(freq >= (long)(-kend) && freq <= (long)(kend) && AverageTurboMach[0] > config->GetAverageMachLimit()){
11262  TwoPiThetaFreq_Pitch = 2*PI_NUMBER*freq*theta/pitch;
11263 
11264  c2ks = -CkInflow[val_marker][iSpan][k]*complex<su2double>(Beta_inf + AverageTurboMach[1])/complex<su2double>( 1.0 + AverageTurboMach[0]);
11265  c3ks = CkInflow[val_marker][iSpan][k]*complex<su2double>(Beta_inf + AverageTurboMach[1])/complex<su2double>( 1.0 + AverageTurboMach[0]);
11266  c3ks *= complex<su2double>(Beta_inf + AverageTurboMach[1])/complex<su2double>( 1.0 + AverageTurboMach[0]);
11267  c2js += c2ks*(complex<su2double>(cos(TwoPiThetaFreq_Pitch))+I*complex<su2double>(sin(TwoPiThetaFreq_Pitch)));
11268  c3js += c3ks*(complex<su2double>(cos(TwoPiThetaFreq_Pitch))+I*complex<su2double>(sin(TwoPiThetaFreq_Pitch)));
11269  }
11270  else{
11271  c2js += complex<su2double>(0.0,0.0);
11272  c3js += complex<su2double>(0.0,0.0);
11273  }
11274  }
11275  c2js_Re = c2js.real();
11276  c3js_Re = c3js.real();
11277 
11278  if (nDim == 2){
11279  dcjs[0] = 0.0 - cj[0];
11280  dcjs[1] = c2js_Re - cj[1];
11281  dcjs[2] = c3js_Re - cj[2];
11282  }else{
11283  dcjs[0] = 0.0 - cj[0];
11284  dcjs[1] = c2js_Re - cj[1];
11285  dcjs[2] = 0.0 - cj[2];
11286  dcjs[3] = c3js_Re - cj[3];
11287  }
11288 
11289  }else{
11290  if (AverageTurboVelocity[val_marker][iSpan][1] >= 0.0){
11291  Beta_inf2= -sqrt(AvgMach - 1.0);
11292  }else{
11293  Beta_inf2= sqrt(AvgMach-1.0);
11294  }
11295  if (nDim == 2){
11296  c2js_Re = -cj[3]*(Beta_inf2 + AverageTurboMach[1])/( 1.0 + AverageTurboMach[0]);
11297  c3js_Re = cj[3]*(Beta_inf2 + AverageTurboMach[1])/( 1.0 + AverageTurboMach[0]);
11298  c3js_Re *= (Beta_inf2 + AverageTurboMach[1])/( 1.0 + AverageTurboMach[0]);
11299  }else{
11300  c2js_Re = -cj[4]*(Beta_inf2 + AverageTurboMach[1])/( 1.0 + AverageTurboMach[0]);
11301  c3js_Re = cj[4]*(Beta_inf2 + AverageTurboMach[1])/( 1.0 + AverageTurboMach[0]);
11302  c3js_Re *= (Beta_inf2 + AverageTurboMach[1])/( 1.0 + AverageTurboMach[0]);
11303  }
11304 
11305 
11306  if (nDim == 2){
11307  dcjs[0] = 0.0 - cj[0];
11308  dcjs[1] = c2js_Re - cj[1];
11309  dcjs[2] = c3js_Re - cj[2];
11310  }else{
11311  dcjs[0] = 0.0 - cj[0];
11312  dcjs[1] = c2js_Re - cj[1];
11313  dcjs[2] = 0.0 - cj[2];
11314  dcjs[3] = c3js_Re - cj[3];
11315  }
11316  }
11317  }
11318  else{
11319  if (nDim == 2){
11320  dcjs[0] = 0.0;
11321  dcjs[1] = 0.0;
11322  dcjs[2] = 0.0;
11323  }else{
11324  dcjs[0] = 0.0;
11325  dcjs[1] = 0.0;
11326  dcjs[2] = 0.0;
11327  dcjs[3] = 0.0;
11328  }
11329  }
11330  /* --- Impose Inlet BC Reflecting--- */
11331  delta_c[0] = relfacAvg*c_avg[0] + relfacFou*dcjs[0];
11332  delta_c[1] = relfacAvg*c_avg[1] + relfacFou*dcjs[1];
11333  delta_c[2] = relfacAvg*c_avg[2] + relfacFou*dcjs[2];
11334  if (nDim == 2){
11335  delta_c[3] = cj[3];
11336  }else{
11337  delta_c[3] = relfacAvg*c_avg[3] + relfacFou*dcjs[3];
11338  delta_c[4] = cj[4];
11339  }
11340  break;
11341 
11342 
11344 
11345  /* --- implementation of Giles BC---*/
11346  if(config->GetSpatialFourier()){
11347  if (AvgMach > 1.0){
11348  /* --- supersonic Giles implementation ---*/
11349  if (AverageTurboVelocity[val_marker][iSpan][1] >= 0.0){
11350  GilesBeta= -sqrt(AvgMach - 1.0);
11351 
11352  }else{
11353  GilesBeta= sqrt(AvgMach - 1.0);
11354  }
11355  if(nDim == 2){
11356  cOutjs_Re= (2.0 * AverageTurboMach[0])/(GilesBeta - AverageTurboMach[1])*cj[1] - (GilesBeta + AverageTurboMach[1])/(GilesBeta - AverageTurboMach[1])*cj[2];
11357  }
11358  else{
11359  cOutjs_Re= (2.0 * AverageTurboMach[0])/(GilesBeta - AverageTurboMach[1])*cj[1] - (GilesBeta + AverageTurboMach[1])/(GilesBeta - AverageTurboMach[1])*cj[3];
11360  }
11361  if (nDim == 2){
11362  dcjs[3] = cOutjs_Re - cj[3];
11363  }
11364  else{
11365  dcjs[4] = cOutjs_Re - cj[4];
11366  }
11367  }else{
11368 
11369  /* --- subsonic Giles implementation ---*/
11370  Beta_inf= I*complex<su2double>(sqrt(1.0 - AvgMach));
11371  cOutjs = complex<su2double>(0.0,0.0);
11372  for(k=0; k < 2*kend_max+1; k++){
11373  freq = k - kend_max;
11374  if(freq >= (long)(-kend) && freq <= (long)(kend) && AverageTurboMach[0] > config->GetAverageMachLimit()){
11375  TwoPiThetaFreq_Pitch = 2*PI_NUMBER*freq*theta/pitch;
11376  cOutks = complex<su2double>(2.0 * AverageTurboMach[0])/complex<su2double>(Beta_inf - AverageTurboMach[1])*CkOutflow1[val_marker][iSpan][k];
11377  cOutks -= complex<su2double>(Beta_inf + AverageTurboMach[1])/complex<su2double>(Beta_inf - AverageTurboMach[1])*CkOutflow2[val_marker][iSpan][k];
11378 
11379  cOutjs += cOutks*(complex<su2double>(cos(TwoPiThetaFreq_Pitch)) + I*complex<su2double>(sin(TwoPiThetaFreq_Pitch)));
11380  }
11381  else{
11382  cOutjs +=complex<su2double>(0.0,0.0);
11383  }
11384  }
11385  cOutjs_Re = cOutjs.real();
11386 
11387  if (nDim == 2){
11388  dcjs[3] = cOutjs_Re - cj[3];
11389  }
11390  else{
11391  dcjs[4] = cOutjs_Re - cj[4];
11392  }
11393  }
11394  }
11395  else{
11396  if (nDim == 2){
11397  dcjs[3] = 0.0;
11398  }
11399  else{
11400  dcjs[4] = 0.0;
11401  }
11402  }
11403  /* --- Impose Outlet BC Non-Reflecting --- */
11404  delta_c[0] = cj[0];
11405  delta_c[1] = cj[1];
11406  delta_c[2] = cj[2];
11407  if (nDim == 2){
11408  delta_c[3] = relfacAvg*c_avg[3] + relfacFou*dcjs[3];
11409  }
11410  else{
11411  delta_c[3] = cj[3];
11412  delta_c[4] = relfacAvg*c_avg[4] + relfacFou*dcjs[4];
11413  }
11414 
11415 
11416  /*--- Automatically impose supersonic autoflow ---*/
11417  if (abs(AverageTurboMach[0]) > 1.0000){
11418  delta_c[0] = 0.0;
11419  delta_c[1] = 0.0;
11420  delta_c[2] = 0.0;
11421  delta_c[2] = 0.0;
11422  if (nDim == 3)delta_c[4] = 0.0;
11423  }
11424 
11425  break;
11426 
11427  default:
11428  SU2_MPI::Error("Invalid Giles input!", CURRENT_FUNCTION);
11429  break;
11430  }
11431 
11432  /*--- Compute primitive jump from characteristic variables ---*/
11433  for (iVar = 0; iVar < nVar; iVar++)
11434  {
11435  deltaprim[iVar]=0.0;
11436  for (jVar = 0; jVar < nVar; jVar++)
11437  {
11438  deltaprim[iVar] += R_Matrix[iVar][jVar]*delta_c[jVar];
11439  }
11440  }
11441 
11442  /*--- retrieve boundary variables ---*/
11443  Density_b = AverageDensity[val_marker][iSpan] + deltaprim[0];
11444  turboVelocity[0] = AverageTurboVelocity[val_marker][iSpan][0] + deltaprim[1];
11445  turboVelocity[1] = AverageTurboVelocity[val_marker][iSpan][1] + deltaprim[2];
11446  if(nDim == 2){
11447  Pressure_b = AveragePressure[val_marker][iSpan] + deltaprim[3];
11448  }
11449  else{
11450  turboVelocity[2] = AverageTurboVelocity[val_marker][iSpan][2] + deltaprim[3];
11451  Pressure_b = AveragePressure[val_marker][iSpan] + deltaprim[4];
11452  }
11453 
11454 
11455  ComputeBackVelocity(turboVelocity, turboNormal, Velocity_b, config->GetMarker_All_TurbomachineryFlag(val_marker), config->GetKind_TurboMachinery(iZone));
11456  Velocity2_b = 0.0;
11457  for (iDim = 0; iDim < nDim; iDim++) {
11458  Velocity2_b+= Velocity_b[iDim]*Velocity_b[iDim];
11459  }
11460 
11461  if(Pressure_b <= 0.0 || Density_b <= 0.0 ){
11462  Pressure_b = Pressure_i;
11463  Density_b = Density_i;
11464  Velocity2_b = 0.0;
11465  for (iDim = 0; iDim < nDim; iDim++) {
11466  Velocity_b[iDim] = Velocity_i[iDim];
11467  Velocity2_b+= Velocity_b[iDim]*Velocity_b[iDim];
11468  }
11469  }
11470 
11471  FluidModel->SetTDState_Prho(Pressure_b, Density_b);
11472  Energy_b = FluidModel->GetStaticEnergy() + 0.5*Velocity2_b;
11473  Temperature_b= FluidModel->GetTemperature();
11474  Enthalpy_b = Energy_b + Pressure_b/Density_b;
11475 
11476  /*--- Primitive variables, using the derived quantities ---*/
11477  V_boundary[0] = Temperature_b;
11478  for (iDim = 0; iDim < nDim; iDim++)
11479  V_boundary[iDim+1] = Velocity_b[iDim];
11480  V_boundary[nDim+1] = Pressure_b;
11481  V_boundary[nDim+2] = Density_b;
11482  V_boundary[nDim+3] = Enthalpy_b;
11483 
11484  S_boundary[0]= FluidModel->GetdPdrho_e();
11485  S_boundary[1]= FluidModel->GetdPde_rho();
11486 
11487 
11488 
11489  /*--- Set various quantities in the solver class ---*/
11490 
11491  conv_numerics->SetPrimitive(V_domain, V_boundary);
11492  conv_numerics->SetSecondary(S_domain, S_boundary);
11493 
11494 
11495  if (grid_movement)
11496  conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
11497 
11498  /*--- Compute the residual using an upwind scheme ---*/
11499 
11500  conv_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
11501 
11502  /*--- Update residual value ---*/
11503  LinSysRes.AddBlock(iPoint, Residual);
11504 
11505  /*--- Jacobian contribution for implicit integration ---*/
11506  if (implicit)
11507  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
11508 
11509  /*--- Roe Turkel preconditioning, set the value of beta ---*/
11510  if (config->GetKind_Upwind() == TURKEL)
11511  node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta());
11512 
11513  /*--- Viscous contribution ---*/
11514 
11515  if (viscous) {
11516 
11517  /*--- Set laminar and eddy viscosity at the infinity ---*/
11518 
11519  V_boundary[nDim+5] = FluidModel->GetLaminarViscosity();
11520  V_boundary[nDim+6] = node[iPoint]->GetEddyViscosity();
11521  V_boundary[nDim+7] = FluidModel->GetThermalConductivity();
11522  V_boundary[nDim+8] = FluidModel->GetCp();
11523 
11524  /*--- Set the normal vector and the coordinates ---*/
11525 
11526  visc_numerics->SetNormal(Normal);
11527  visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
11528 
11529  /*--- Primitive variables, and gradient ---*/
11530 
11531  visc_numerics->SetPrimitive(V_domain, V_boundary);
11532  visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
11533 
11534 
11535  /*--- Compute secondary thermodynamic properties (partial derivatives...) ---*/
11536 
11537  S_boundary[0]= FluidModel->GetdPdrho_e();
11538  S_boundary[1]= FluidModel->GetdPde_rho();
11539 
11540  S_boundary[2]= FluidModel->GetdTdrho_e();
11541  S_boundary[3]= FluidModel->GetdTde_rho();
11542 
11543  /*--- Compute secondary thermo-physical properties (partial derivatives...) ---*/
11544 
11545  S_boundary[4]= FluidModel->Getdmudrho_T();
11546  S_boundary[5]= FluidModel->GetdmudT_rho();
11547 
11548  S_boundary[6]= FluidModel->Getdktdrho_T();
11549  S_boundary[7]= FluidModel->GetdktdT_rho();
11550 
11551  visc_numerics->SetSecondary(S_domain, S_boundary);
11552 
11553  /*--- Turbulent kinetic energy ---*/
11554 
11555  if (config->GetKind_Turb_Model() == SST)
11556  visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
11557 
11558  /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
11559 
11560  visc_numerics->SetTauWall(-1.0, -1.0);
11561 
11562  /*--- Compute and update residual ---*/
11563 
11564  visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
11565  LinSysRes.SubtractBlock(iPoint, Residual);
11566 
11567  /*--- Jacobian contribution for implicit integration ---*/
11568 
11569  if (implicit)
11570  Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
11571 
11572  }
11573 
11574  }
11575  }
11576 
11577  /*--- Free locally allocated memory ---*/
11578  delete [] Normal;
11579 
11580  delete [] Velocity_b;
11581  delete [] Velocity_i;
11582 
11583  delete [] S_boundary;
11584  delete [] delta_c;
11585  delete [] deltaprim;
11586  delete [] cj;
11587  for (iVar = 0; iVar < nVar; iVar++)
11588  {
11589  delete [] R_Matrix[iVar];
11590  }
11591  for (iVar = 0; iVar < nVar-1; iVar++)
11592  {
11593  delete [] R_c_inv[iVar];
11594  delete [] R_c[iVar];
11595  }
11596  delete [] R_Matrix;
11597  delete [] R_c;
11598  delete [] R_c_inv;
11599  delete [] R;
11600  delete [] c_avg;
11601  delete [] dcjs;
11602 
11603  delete [] AverageTurboMach;
11604  delete [] UnitNormal;
11605  delete [] turboNormal;
11606  delete [] turboVelocity;
11607 }
11608 
11609 void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
11610  CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
11611  unsigned short iDim;
11612  unsigned long iVertex, iPoint;
11613  su2double P_Total, T_Total, Velocity[3], Velocity2, H_Total, Temperature, Riemann,
11614  Pressure, Density, Energy, *Flow_Dir, Mach2, SoundSpeed2, SoundSpeed_Total2, Vel_Mag,
11615  alpha, aa, bb, cc, dd, Area, UnitNormal[3];
11616  su2double *V_inlet, *V_domain;
11617 
11618  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
11619  bool grid_movement = config->GetGrid_Movement();
11620  su2double Two_Gamma_M1 = 2.0/Gamma_Minus_One;
11621  su2double Gas_Constant = config->GetGas_ConstantND();
11622  unsigned short Kind_Inlet = config->GetKind_Inlet();
11623  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
11624  bool tkeNeeded = (((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS)) &&
11625  (config->GetKind_Turb_Model() == SST));
11626  su2double *Normal = new su2double[nDim];
11627 
11628  /*--- Loop over all the vertices on this boundary marker ---*/
11629 
11630  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
11631 
11632  /*--- Allocate the value at the inlet ---*/
11633 
11634  V_inlet = GetCharacPrimVar(val_marker, iVertex);
11635 
11636  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
11637 
11638  /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
11639 
11640  if (geometry->node[iPoint]->GetDomain()) {
11641 
11642  /*--- Normal vector for this vertex (negate for outward convention) ---*/
11643 
11644  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
11645  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
11646  conv_numerics->SetNormal(Normal);
11647 
11648  Area = 0.0;
11649  for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
11650  Area = sqrt (Area);
11651 
11652  for (iDim = 0; iDim < nDim; iDim++)
11653  UnitNormal[iDim] = Normal[iDim]/Area;
11654 
11655  /*--- Retrieve solution at this boundary node ---*/
11656 
11657  V_domain = node[iPoint]->GetPrimitive();
11658 
11659  /*--- Build the fictitious intlet state based on characteristics ---*/
11660 
11661 
11662  /*--- Subsonic inflow: there is one outgoing characteristic (u-c),
11663  therefore we can specify all but one state variable at the inlet.
11664  The outgoing Riemann invariant provides the final piece of info.
11665  Adapted from an original implementation in the Stanford University
11666  multi-block (SUmb) solver in the routine bcSubsonicInflow.f90
11667  written by Edwin van der Weide, last modified 04-20-2009. ---*/
11668 
11669  switch (Kind_Inlet) {
11670 
11671  /*--- Total properties have been specified at the inlet. ---*/
11672 
11673  case TOTAL_CONDITIONS:
11674 
11675  /*--- Retrieve the specified total conditions for this inlet. ---*/
11676 
11677  P_Total = Inlet_Ptotal[val_marker][iVertex];
11678  T_Total = Inlet_Ttotal[val_marker][iVertex];
11679  Flow_Dir = Inlet_FlowDir[val_marker][iVertex];
11680 
11681  /*--- Non-dim. the inputs if necessary. ---*/
11682 
11683  P_Total /= config->GetPressure_Ref();
11684  T_Total /= config->GetTemperature_Ref();
11685 
11686  /*--- Store primitives and set some variables for clarity. ---*/
11687 
11688  Density = V_domain[nDim+2];
11689  Velocity2 = 0.0;
11690  for (iDim = 0; iDim < nDim; iDim++) {
11691  Velocity[iDim] = V_domain[iDim+1];
11692  Velocity2 += Velocity[iDim]*Velocity[iDim];
11693  }
11694  Energy = V_domain[nDim+3] - V_domain[nDim+1]/V_domain[nDim+2];
11695  Pressure = V_domain[nDim+1];
11696  H_Total = (Gamma*Gas_Constant/Gamma_Minus_One)*T_Total;
11697  SoundSpeed2 = Gamma*Pressure/Density;
11698 
11699  /*--- Compute the acoustic Riemann invariant that is extrapolated
11700  from the domain interior. ---*/
11701 
11702  Riemann = 2.0*sqrt(SoundSpeed2)/Gamma_Minus_One;
11703  for (iDim = 0; iDim < nDim; iDim++)
11704  Riemann += Velocity[iDim]*UnitNormal[iDim];
11705 
11706  /*--- Total speed of sound ---*/
11707 
11708  SoundSpeed_Total2 = Gamma_Minus_One*(H_Total - (Energy + Pressure/Density)+0.5*Velocity2) + SoundSpeed2;
11709 
11710  /*--- Dot product of normal and flow direction. This should
11711  be negative due to outward facing boundary normal convention. ---*/
11712 
11713  alpha = 0.0;
11714  for (iDim = 0; iDim < nDim; iDim++)
11715  alpha += UnitNormal[iDim]*Flow_Dir[iDim];
11716 
11717  /*--- Coefficients in the quadratic equation for the velocity ---*/
11718 
11719  aa = 1.0 + 0.5*Gamma_Minus_One*alpha*alpha;
11720  bb = -1.0*Gamma_Minus_One*alpha*Riemann;
11721  cc = 0.5*Gamma_Minus_One*Riemann*Riemann
11722  -2.0*SoundSpeed_Total2/Gamma_Minus_One;
11723 
11724  /*--- Solve quadratic equation for velocity magnitude. Value must
11725  be positive, so the choice of root is clear. ---*/
11726 
11727  dd = bb*bb - 4.0*aa*cc;
11728  dd = sqrt(max(0.0, dd));
11729  Vel_Mag = (-bb + dd)/(2.0*aa);
11730  Vel_Mag = max(0.0, Vel_Mag);
11731  Velocity2 = Vel_Mag*Vel_Mag;
11732 
11733  /*--- Compute speed of sound from total speed of sound eqn. ---*/
11734 
11735  SoundSpeed2 = SoundSpeed_Total2 - 0.5*Gamma_Minus_One*Velocity2;
11736 
11737  /*--- Mach squared (cut between 0-1), use to adapt velocity ---*/
11738 
11739  Mach2 = Velocity2/SoundSpeed2;
11740  Mach2 = min(1.0, Mach2);
11741  Velocity2 = Mach2*SoundSpeed2;
11742  Vel_Mag = sqrt(Velocity2);
11743  SoundSpeed2 = SoundSpeed_Total2 - 0.5*Gamma_Minus_One*Velocity2;
11744 
11745  /*--- Compute new velocity vector at the inlet ---*/
11746 
11747  for (iDim = 0; iDim < nDim; iDim++)
11748  Velocity[iDim] = Vel_Mag*Flow_Dir[iDim];
11749 
11750  /*--- Static temperature from the speed of sound relation ---*/
11751 
11752  Temperature = SoundSpeed2/(Gamma*Gas_Constant);
11753 
11754  /*--- Static pressure using isentropic relation at a point ---*/
11755 
11756  Pressure = P_Total*pow((Temperature/T_Total), Gamma/Gamma_Minus_One);
11757 
11758  /*--- Density at the inlet from the gas law ---*/
11759 
11760  Density = Pressure/(Gas_Constant*Temperature);
11761 
11762  /*--- Using pressure, density, & velocity, compute the energy ---*/
11763 
11764  Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2;
11765  if (tkeNeeded) Energy += GetTke_Inf();
11766 
11767  /*--- Primitive variables, using the derived quantities ---*/
11768 
11769  V_inlet[0] = Temperature;
11770  for (iDim = 0; iDim < nDim; iDim++)
11771  V_inlet[iDim+1] = Velocity[iDim];
11772  V_inlet[nDim+1] = Pressure;
11773  V_inlet[nDim+2] = Density;
11774  V_inlet[nDim+3] = Energy + Pressure/Density;
11775 
11776  break;
11777 
11778  /*--- Mass flow has been specified at the inlet. ---*/
11779 
11780  case MASS_FLOW:
11781 
11782  /*--- Retrieve the specified mass flow for the inlet. ---*/
11783 
11784  Density = Inlet_Ttotal[val_marker][iVertex];
11785  Vel_Mag = Inlet_Ptotal[val_marker][iVertex];
11786  Flow_Dir = Inlet_FlowDir[val_marker][iVertex];
11787 
11788  /*--- Non-dim. the inputs if necessary. ---*/
11789 
11790  Density /= config->GetDensity_Ref();
11791  Vel_Mag /= config->GetVelocity_Ref();
11792 
11793  /*--- Get primitives from current inlet state. ---*/
11794 
11795  for (iDim = 0; iDim < nDim; iDim++)
11796  Velocity[iDim] = node[iPoint]->GetVelocity(iDim);
11797  Pressure = node[iPoint]->GetPressure();
11798  SoundSpeed2 = Gamma*Pressure/V_domain[nDim+2];
11799 
11800  /*--- Compute the acoustic Riemann invariant that is extrapolated
11801  from the domain interior. ---*/
11802 
11803  Riemann = Two_Gamma_M1*sqrt(SoundSpeed2);
11804  for (iDim = 0; iDim < nDim; iDim++)
11805  Riemann += Velocity[iDim]*UnitNormal[iDim];
11806 
11807  /*--- Speed of sound squared for fictitious inlet state ---*/
11808 
11809  SoundSpeed2 = Riemann;
11810  for (iDim = 0; iDim < nDim; iDim++)
11811  SoundSpeed2 -= Vel_Mag*Flow_Dir[iDim]*UnitNormal[iDim];
11812 
11813  SoundSpeed2 = max(0.0,0.5*Gamma_Minus_One*SoundSpeed2);
11814  SoundSpeed2 = SoundSpeed2*SoundSpeed2;
11815 
11816  /*--- Pressure for the fictitious inlet state ---*/
11817 
11818  Pressure = SoundSpeed2*Density/Gamma;
11819 
11820  /*--- Energy for the fictitious inlet state ---*/
11821 
11822  Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Vel_Mag*Vel_Mag;
11823  if (tkeNeeded) Energy += GetTke_Inf();
11824 
11825  /*--- Primitive variables, using the derived quantities ---*/
11826 
11827  V_inlet[0] = Pressure / ( Gas_Constant * Density);
11828  for (iDim = 0; iDim < nDim; iDim++)
11829  V_inlet[iDim+1] = Vel_Mag*Flow_Dir[iDim];
11830  V_inlet[nDim+1] = Pressure;
11831  V_inlet[nDim+2] = Density;
11832  V_inlet[nDim+3] = Energy + Pressure/Density;
11833 
11834  break;
11835  }
11836 
11837  /*--- Set various quantities in the solver class ---*/
11838 
11839  conv_numerics->SetPrimitive(V_domain, V_inlet);
11840 
11841  if (grid_movement)
11842  conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
11843 
11844  /*--- Compute the residual using an upwind scheme ---*/
11845 
11846  conv_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
11847 
11848  /*--- Update residual value ---*/
11849 
11850  LinSysRes.AddBlock(iPoint, Residual);
11851 
11852  /*--- Jacobian contribution for implicit integration ---*/
11853 
11854  if (implicit)
11855  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
11856 
11857  /*--- Roe Turkel preconditioning, set the value of beta ---*/
11858 
11859  if (config->GetKind_Upwind() == TURKEL)
11860  node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta());
11861 
11862 // /*--- Viscous contribution, commented out because serious convergence problems ---*/
11863 //
11864 // if (viscous) {
11865 //
11866 // /*--- Set laminar and eddy viscosity at the infinity ---*/
11867 //
11868 // V_inlet[nDim+5] = node[iPoint]->GetLaminarViscosity();
11869 // V_inlet[nDim+6] = node[iPoint]->GetEddyViscosity();
11870 //
11871 // /*--- Set the normal vector and the coordinates ---*/
11872 //
11873 // visc_numerics->SetNormal(Normal);
11874 // visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
11875 //
11876 // /*--- Primitive variables, and gradient ---*/
11877 //
11878 // visc_numerics->SetPrimitive(V_domain, V_inlet);
11879 // visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
11880 //
11881 // /*--- Turbulent kinetic energy ---*/
11882 //
11883 // if (config->GetKind_Turb_Model() == SST)
11884 // visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
11885 //
11886 // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
11887 //
11888 // visc_numerics->SetTauWall(-1.0, -1.0);
11889 //
11890 // /*--- Compute and update residual ---*/
11891 //
11892 // visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
11893 // LinSysRes.SubtractBlock(iPoint, Residual);
11894 //
11895 // /*--- Jacobian contribution for implicit integration ---*/
11896 //
11897 // if (implicit)
11898 // Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
11899 //
11900 // }
11901 
11902  }
11903  }
11904 
11905  /*--- Free locally allocated memory ---*/
11906 
11907  delete [] Normal;
11908 
11909 }
11910 
11911 void CEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
11912  CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
11913  unsigned short iVar, iDim;
11914  unsigned long iVertex, iPoint;
11915  su2double Pressure, P_Exit, Velocity[3],
11916  Velocity2, Entropy, Density, Energy, Riemann, Vn, SoundSpeed, Mach_Exit, Vn_Exit,
11917  Area, UnitNormal[3];
11918  su2double *V_outlet, *V_domain;
11919 
11920  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
11921  su2double Gas_Constant = config->GetGas_ConstantND();
11922  bool grid_movement = config->GetGrid_Movement();
11923  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
11924  bool gravity = (config->GetGravityForce());
11925  bool tkeNeeded = (((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS)) &&
11926  (config->GetKind_Turb_Model() == SST));
11927  su2double *Normal = new su2double[nDim];
11928 
11929  /*--- Loop over all the vertices on this boundary marker ---*/
11930  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
11931 
11932  /*--- Allocate the value at the outlet ---*/
11933  V_outlet = GetCharacPrimVar(val_marker, iVertex);
11934 
11935  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
11936 
11937  /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
11938  if (geometry->node[iPoint]->GetDomain()) {
11939 
11940  /*--- Normal vector for this vertex (negate for outward convention) ---*/
11941  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
11942  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
11943  conv_numerics->SetNormal(Normal);
11944 
11945  Area = 0.0;
11946  for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
11947  Area = sqrt (Area);
11948 
11949  for (iDim = 0; iDim < nDim; iDim++)
11950  UnitNormal[iDim] = Normal[iDim]/Area;
11951 
11952  /*--- Current solution at this boundary node ---*/
11953  V_domain = node[iPoint]->GetPrimitive();
11954 
11955  /*--- Build the fictitious intlet state based on characteristics ---*/
11956 
11957  /*--- Retrieve the specified back pressure for this outlet. ---*/
11958  if (gravity) P_Exit = config->GetOutlet_Pressure(Marker_Tag) - geometry->node[iPoint]->GetCoord(nDim-1)*STANDARD_GRAVITY;
11959  else P_Exit = config->GetOutlet_Pressure(Marker_Tag);
11960 
11961  /*--- Non-dim. the inputs if necessary. ---*/
11962  P_Exit = P_Exit/config->GetPressure_Ref();
11963 
11964  /*--- Check whether the flow is supersonic at the exit. The type
11965  of boundary update depends on this. ---*/
11966  Density = V_domain[nDim+2];
11967  Velocity2 = 0.0; Vn = 0.0;
11968  for (iDim = 0; iDim < nDim; iDim++) {
11969  Velocity[iDim] = V_domain[iDim+1];
11970  Velocity2 += Velocity[iDim]*Velocity[iDim];
11971  Vn += Velocity[iDim]*UnitNormal[iDim];
11972  }
11973  Pressure = V_domain[nDim+1];
11974  SoundSpeed = sqrt(Gamma*Pressure/Density);
11975  Mach_Exit = sqrt(Velocity2)/SoundSpeed;
11976 
11977  if (Mach_Exit >= 1.0) {
11978 
11979  /*--- Supersonic exit flow: there are no incoming characteristics,
11980  so no boundary condition is necessary. Set outlet state to current
11981  state so that upwinding handles the direction of propagation. ---*/
11982  for (iVar = 0; iVar < nPrimVar; iVar++) V_outlet[iVar] = V_domain[iVar];
11983 
11984  } else {
11985 
11986  /*--- Subsonic exit flow: there is one incoming characteristic,
11987  therefore one variable can be specified (back pressure) and is used
11988  to update the conservative variables. Compute the entropy and the
11989  acoustic Riemann variable. These invariants, as well as the
11990  tangential velocity components, are extrapolated. Adapted from an
11991  original implementation in the Stanford University multi-block
11992  (SUmb) solver in the routine bcSubsonicOutflow.f90 by Edwin van
11993  der Weide, last modified 09-10-2007. ---*/
11994 
11995  Entropy = Pressure*pow(1.0/Density, Gamma);
11996  Riemann = Vn + 2.0*SoundSpeed/Gamma_Minus_One;
11997 
11998  /*--- Compute the new fictious state at the outlet ---*/
11999  Density = pow(P_Exit/Entropy,1.0/Gamma);
12000  Pressure = P_Exit;
12001  SoundSpeed = sqrt(Gamma*P_Exit/Density);
12002  Vn_Exit = Riemann - 2.0*SoundSpeed/Gamma_Minus_One;
12003  Velocity2 = 0.0;
12004  for (iDim = 0; iDim < nDim; iDim++) {
12005  Velocity[iDim] = Velocity[iDim] + (Vn_Exit-Vn)*UnitNormal[iDim];
12006  Velocity2 += Velocity[iDim]*Velocity[iDim];
12007  }
12008  Energy = P_Exit/(Density*Gamma_Minus_One) + 0.5*Velocity2;
12009  if (tkeNeeded) Energy += GetTke_Inf();
12010 
12011  /*--- Conservative variables, using the derived quantities ---*/
12012  V_outlet[0] = Pressure / ( Gas_Constant * Density);
12013  for (iDim = 0; iDim < nDim; iDim++)
12014  V_outlet[iDim+1] = Velocity[iDim];
12015  V_outlet[nDim+1] = Pressure;
12016  V_outlet[nDim+2] = Density;
12017  V_outlet[nDim+3] = Energy + Pressure/Density;
12018 
12019  }
12020 
12021  /*--- Set various quantities in the solver class ---*/
12022  conv_numerics->SetPrimitive(V_domain, V_outlet);
12023 
12024  if (grid_movement)
12025  conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
12026 
12027  /*--- Compute the residual using an upwind scheme ---*/
12028  conv_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
12029 
12030  /*--- Update residual value ---*/
12031  LinSysRes.AddBlock(iPoint, Residual);
12032 
12033  /*--- Jacobian contribution for implicit integration ---*/
12034  if (implicit) {
12035  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
12036  }
12037 
12038  /*--- Roe Turkel preconditioning, set the value of beta ---*/
12039  if (config->GetKind_Upwind() == TURKEL)
12040  node[iPoint]->SetPreconditioner_Beta(conv_numerics->GetPrecond_Beta());
12041 
12042 // /*--- Viscous contribution, commented out because serious convergence problems ---*/
12043 //
12044 // if (viscous) {
12045 //
12046 // /*--- Set laminar and eddy viscosity at the infinity ---*/
12047 //
12048 // V_outlet[nDim+5] = node[iPoint]->GetLaminarViscosity();
12049 // V_outlet[nDim+6] = node[iPoint]->GetEddyViscosity();
12050 //
12051 // /*--- Set the normal vector and the coordinates ---*/
12052 //
12053 // visc_numerics->SetNormal(Normal);
12054 // visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
12055 //
12056 // /*--- Primitive variables, and gradient ---*/
12057 //
12058 // visc_numerics->SetPrimitive(V_domain, V_outlet);
12059 // visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
12060 //
12061 // /*--- Turbulent kinetic energy ---*/
12062 //
12063 // if (config->GetKind_Turb_Model() == SST)
12064 // visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
12065 //
12066 // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
12067 // visc_numerics->SetTauWall(-1.0, -1.0);
12068 //
12069 // /*--- Compute and update residual ---*/
12070 //
12071 // visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
12072 // LinSysRes.SubtractBlock(iPoint, Residual);
12073 //
12074 // /*--- Jacobian contribution for implicit integration ---*/
12075 //
12076 // if (implicit)
12077 // Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
12078 //
12079 // }
12080 
12081  }
12082  }
12083 
12084  /*--- Free locally allocated memory ---*/
12085  delete [] Normal;
12086 
12087 }
12088 
12089 void CEulerSolver::BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_container,
12090  CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
12091  unsigned short iDim;
12092  unsigned long iVertex, iPoint;
12093  su2double *V_inlet, *V_domain;
12094 
12095  su2double Density, Pressure, Temperature, Energy, *Vel, Velocity2;
12096  su2double Gas_Constant = config->GetGas_ConstantND();
12097 
12098  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
12099  bool grid_movement = config->GetGrid_Movement();
12100  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
12101  bool tkeNeeded = (((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS)) &&
12102  (config->GetKind_Turb_Model() == SST));
12103  su2double *Normal = new su2double[nDim];
12104  su2double *Velocity = new su2double[nDim];
12105 
12106  /*--- Supersonic inlet flow: there are no outgoing characteristics,
12107  so all flow variables can be imposed at the inlet.
12108  First, retrieve the specified values for the primitive variables. ---*/
12109 
12110  Temperature = config->GetInlet_Temperature(Marker_Tag);
12111  Pressure = config->GetInlet_Pressure(Marker_Tag);
12112  Vel = config->GetInlet_Velocity(Marker_Tag);
12113 
12114  /*--- Non-dim. the inputs if necessary. ---*/
12115 
12116  Temperature /= config->GetTemperature_Ref();
12117  Pressure /= config->GetPressure_Ref();
12118  for (iDim = 0; iDim < nDim; iDim++)
12119  Velocity[iDim] = Vel[iDim] / config->GetVelocity_Ref();
12120 
12121  /*--- Density at the inlet from the gas law ---*/
12122 
12123  Density = Pressure/(Gas_Constant*Temperature);
12124 
12125  /*--- Compute the energy from the specified state ---*/
12126 
12127  Velocity2 = 0.0;
12128  for (iDim = 0; iDim < nDim; iDim++)
12129  Velocity2 += Velocity[iDim]*Velocity[iDim];
12130  Energy = Pressure/(Density*Gamma_Minus_One)+0.5*Velocity2;
12131  if (tkeNeeded) Energy += GetTke_Inf();
12132 
12133  /*--- Loop over all the vertices on this boundary marker ---*/
12134 
12135  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
12136 
12137  /*--- Allocate the value at the outlet ---*/
12138 
12139  V_inlet = GetCharacPrimVar(val_marker, iVertex);
12140 
12141  /*--- Primitive variables, using the derived quantities ---*/
12142 
12143  V_inlet[0] = Temperature;
12144  for (iDim = 0; iDim < nDim; iDim++)
12145  V_inlet[iDim+1] = Velocity[iDim];
12146  V_inlet[nDim+1] = Pressure;
12147  V_inlet[nDim+2] = Density;
12148  V_inlet[nDim+3] = Energy + Pressure/Density;
12149 
12150  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
12151 
12152  /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
12153 
12154  if (geometry->node[iPoint]->GetDomain()) {
12155 
12156  /*--- Current solution at this boundary node ---*/
12157 
12158  V_domain = node[iPoint]->GetPrimitive();
12159 
12160  /*--- Normal vector for this vertex (negate for outward convention) ---*/
12161 
12162  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
12163  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
12164 
12165  /*--- Set various quantities in the solver class ---*/
12166 
12167  conv_numerics->SetNormal(Normal);
12168  conv_numerics->SetPrimitive(V_domain, V_inlet);
12169 
12170  if (grid_movement)
12171  conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
12172  geometry->node[iPoint]->GetGridVel());
12173 
12174  /*--- Compute the residual using an upwind scheme ---*/
12175 
12176  conv_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
12177  LinSysRes.AddBlock(iPoint, Residual);
12178 
12179  /*--- Jacobian contribution for implicit integration ---*/
12180 
12181  if (implicit)
12182  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
12183 
12184 // /*--- Viscous contribution, commented out because serious convergence problems ---*/
12185 //
12186 // if (viscous) {
12187 //
12188 // /*--- Set laminar and eddy viscosity at the infinity ---*/
12189 //
12190 // V_inlet[nDim+5] = node[iPoint]->GetLaminarViscosity();
12191 // V_inlet[nDim+6] = node[iPoint]->GetEddyViscosity();
12192 //
12193 // /*--- Set the normal vector and the coordinates ---*/
12194 //
12195 // visc_numerics->SetNormal(Normal);
12196 // visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
12197 //
12198 // /*--- Primitive variables, and gradient ---*/
12199 //
12200 // visc_numerics->SetPrimitive(V_domain, V_inlet);
12201 // visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
12202 //
12203 // /*--- Turbulent kinetic energy ---*/
12204 //
12205 // if (config->GetKind_Turb_Model() == SST)
12206 // visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
12207 //
12208 // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
12209 //
12210 // visc_numerics->SetTauWall(-1.0, -1.0);
12211 //
12212 // /*--- Compute and update residual ---*/
12213 //
12214 // visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
12215 // LinSysRes.SubtractBlock(iPoint, Residual);
12216 //
12217 // /*--- Jacobian contribution for implicit integration ---*/
12218 //
12219 // if (implicit)
12220 // Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
12221 // }
12222 
12223  }
12224  }
12225 
12226  /*--- Free locally allocated memory ---*/
12227 
12228  delete [] Normal;
12229  delete [] Velocity;
12230 
12231 }
12232 
12233 void CEulerSolver::BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver_container,
12234  CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
12235  unsigned short iDim;
12236  unsigned long iVertex, iPoint;
12237  su2double *V_outlet, *V_domain;
12238 
12239  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
12240  bool grid_movement = config->GetGrid_Movement();
12241  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
12242 
12243  su2double *Normal = new su2double[nDim];
12244 
12245  /*--- Supersonic outlet flow: there are no ingoing characteristics,
12246  so all flow variables can should be interpolated from the domain. ---*/
12247 
12248  /*--- Loop over all the vertices on this boundary marker ---*/
12249 
12250  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
12251 
12252  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
12253 
12254  /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
12255 
12256  if (geometry->node[iPoint]->GetDomain()) {
12257 
12258  /*--- Current solution at this boundary node ---*/
12259 
12260  V_domain = node[iPoint]->GetPrimitive();
12261 
12262  /*--- Allocate the value at the outlet ---*/
12263 
12264  V_outlet = GetCharacPrimVar(val_marker, iVertex);
12265 
12266  /*--- Primitive variables, using the derived quantities ---*/
12267 
12268  V_outlet[0] = V_domain[0];
12269  for (iDim = 0; iDim < nDim; iDim++)
12270  V_outlet[iDim+1] = V_domain[iDim+1];
12271  V_outlet[nDim+1] = V_domain[nDim+1];
12272  V_outlet[nDim+2] = V_domain[nDim+2];
12273  V_outlet[nDim+3] = V_domain[nDim+3];
12274 
12275  /*--- Current solution at this boundary node ---*/
12276 
12277  V_domain = node[iPoint]->GetPrimitive();
12278 
12279  /*--- Normal vector for this vertex (negate for outward convention) ---*/
12280 
12281  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
12282  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
12283 
12284  /*--- Set various quantities in the solver class ---*/
12285 
12286  conv_numerics->SetNormal(Normal);
12287  conv_numerics->SetPrimitive(V_domain, V_outlet);
12288 
12289  if (grid_movement)
12290  conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(),
12291  geometry->node[iPoint]->GetGridVel());
12292 
12293  /*--- Compute the residual using an upwind scheme ---*/
12294 
12295  conv_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
12296  LinSysRes.AddBlock(iPoint, Residual);
12297 
12298  /*--- Jacobian contribution for implicit integration ---*/
12299 
12300  if (implicit)
12301  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
12302 
12303  // /*--- Viscous contribution, commented out because serious convergence problems ---*/
12304  //
12305  // if (viscous) {
12306  //
12307  // /*--- Set laminar and eddy viscosity at the infinity ---*/
12308  //
12309  // V_outlet[nDim+5] = node[iPoint]->GetLaminarViscosity();
12310  // V_outlet[nDim+6] = node[iPoint]->GetEddyViscosity();
12311  //
12312  // /*--- Set the normal vector and the coordinates ---*/
12313  //
12314  // visc_numerics->SetNormal(Normal);
12315  // visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
12316  //
12317  // /*--- Primitive variables, and gradient ---*/
12318  //
12319  // visc_numerics->SetPrimitive(V_domain, V_outlet);
12320  // visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
12321  //
12322  // /*--- Turbulent kinetic energy ---*/
12323  //
12324  // if (config->GetKind_Turb_Model() == SST)
12325  // visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
12326 //
12327 // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
12328 //
12329 // visc_numerics->SetTauWall(-1.0, -1.0);
12330 //
12331 // /*--- Compute and update residual ---*/
12332 //
12333 // visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
12334 // LinSysRes.SubtractBlock(iPoint, Residual);
12335 //
12336 // /*--- Jacobian contribution for implicit integration ---*/
12337 //
12338 // if (implicit)
12339 // Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
12340 // }
12341 
12342  }
12343  }
12344 
12345  /*--- Free locally allocated memory ---*/
12346 
12347  delete [] Normal;
12348 
12349 }
12350 
12351 void CEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
12352 
12353  unsigned short iDim;
12354  unsigned long iVertex, iPoint;
12355  su2double Pressure, Inflow_Pressure = 0.0, Velocity[3], Velocity2, Entropy, Target_Inflow_MassFlow = 0.0, Target_Inflow_Mach = 0.0, Density, Energy,
12356  Riemann, Area, UnitNormal[3], Vn, SoundSpeed, Vn_Exit, Inflow_Pressure_inc, Inflow_Pressure_old, Inflow_Mach_old, Inflow_MassFlow_old;
12357  su2double *V_inflow, *V_domain;
12358 
12359  bool grid_movement = config->GetGrid_Movement();
12360 
12361  su2double DampingFactor = config->GetDamp_Engine_Inflow();
12362  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
12363  unsigned short Kind_Engine_Inflow = config->GetKind_Engine_Inflow();
12364  su2double Gas_Constant = config->GetGas_ConstantND();
12365  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
12366  bool tkeNeeded = (((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS)) &&
12367  (config->GetKind_Turb_Model() == SST));
12368  su2double Baseline_Press = 0.75 * config->GetPressure_FreeStreamND();
12369  bool Engine_HalfModel = config->GetEngine_HalfModel();
12370 
12371  su2double *Normal = new su2double[nDim];
12372 
12373 
12374  if (Kind_Engine_Inflow == FAN_FACE_MACH) {
12375 
12376  /*--- Retrieve the specified target fan face mach at the nacelle. ---*/
12377 
12378  Target_Inflow_Mach = config->GetEngineInflow_Target(Marker_Tag);
12379 
12380  /*--- Retrieve the old fan face pressure and mach number in the nacelle (this has been computed in a preprocessing). ---*/
12381 
12382  Inflow_Pressure_old = config->GetInflow_Pressure(Marker_Tag); // Note that has been computed by the code (non-dimensional).
12383  Inflow_Mach_old = config->GetInflow_Mach(Marker_Tag);
12384 
12385  /*--- Compute the pressure increment (note that increasing pressure decreases flow speed) ---*/
12386 
12387  Inflow_Pressure_inc = - (1.0 - (Inflow_Mach_old/Target_Inflow_Mach)) * Baseline_Press;
12388 
12389  /*--- Estimate the new fan face pressure ---*/
12390 
12391  Inflow_Pressure = (1.0 - DampingFactor)*Inflow_Pressure_old + DampingFactor * (Inflow_Pressure_old + Inflow_Pressure_inc);
12392 
12393  }
12394 
12395  if (Kind_Engine_Inflow == FAN_FACE_MDOT) {
12396 
12397  /*--- Retrieve the specified target mass flow (non-dimensional) at the nacelle. ---*/
12398 
12399  Target_Inflow_MassFlow = config->GetEngineInflow_Target(Marker_Tag) / (config->GetDensity_Ref() * config->GetVelocity_Ref());
12400 
12401  if (config->GetSystemMeasurements() == US) Target_Inflow_MassFlow /= 32.174;
12402 
12403  if (Engine_HalfModel) Target_Inflow_MassFlow /= 2.0;
12404 
12405  /*--- Retrieve the old fan face pressure and mach number in the nacelle (this has been computed in a preprocessing). ---*/
12406 
12407  Inflow_Pressure_old = config->GetInflow_Pressure(Marker_Tag); // Note that has been computed by the code (non-dimensional).
12408  Inflow_MassFlow_old = config->GetInflow_MassFlow(Marker_Tag); // same here... it is a non dimensional value
12409 
12410  /*--- Compute the pressure increment (note that increasing pressure decreases flow speed) ---*/
12411 
12412  Inflow_Pressure_inc = - (1.0 - (Inflow_MassFlow_old/Target_Inflow_MassFlow)) * Baseline_Press;
12413 
12414  /*--- Estimate the new fan face pressure ---*/
12415 
12416  Inflow_Pressure = (1.0 - DampingFactor)*Inflow_Pressure_old + DampingFactor * (Inflow_Pressure_old + Inflow_Pressure_inc);
12417 
12418  }
12419 
12420  /*--- No iterative scheme if we provide the static pressure ---*/
12421 
12422  if (Kind_Engine_Inflow == FAN_FACE_PRESSURE) {
12423 
12424  /*--- Retrieve the specified pressure (non-dimensional) at the nacelle. ---*/
12425 
12426  Inflow_Pressure = config->GetEngineInflow_Target(Marker_Tag) / config->GetPressure_Ref();
12427 
12428  }
12429 
12430 
12431  /*--- Loop over all the vertices on this boundary marker ---*/
12432 
12433  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
12434 
12435  /*--- Allocate the value at the outlet ---*/
12436 
12437  V_inflow = GetCharacPrimVar(val_marker, iVertex);
12438 
12439  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
12440 
12441  /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
12442 
12443  if (geometry->node[iPoint]->GetDomain()) {
12444 
12445  /*--- Normal vector for this vertex (negate for outward convention) ---*/
12446 
12447  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
12448  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
12449 
12450  Area = 0.0;
12451  for (iDim = 0; iDim < nDim; iDim++)
12452  Area += Normal[iDim]*Normal[iDim];
12453  Area = sqrt (Area);
12454 
12455  for (iDim = 0; iDim < nDim; iDim++)
12456  UnitNormal[iDim] = Normal[iDim]/Area;
12457 
12458  /*--- Current solution at this boundary node ---*/
12459 
12460  V_domain = node[iPoint]->GetPrimitive();
12461 
12462  /*--- Subsonic nacelle inflow: there is one incoming characteristic,
12463  therefore one variable can be specified (back pressure) and is used
12464  to update the conservative variables.
12465 
12466  Compute the entropy and the acoustic variable. These
12467  riemann invariants, as well as the tangential velocity components,
12468  are extrapolated. ---*/
12469 
12470  Density = V_domain[nDim+2];
12471  Velocity2 = 0.0; Vn = 0.0;
12472  for (iDim = 0; iDim < nDim; iDim++) {
12473  Velocity[iDim] = V_domain[iDim+1];
12474  Velocity2 += Velocity[iDim]*Velocity[iDim];
12475  Vn += Velocity[iDim]*UnitNormal[iDim];
12476  }
12477  Pressure = V_domain[nDim+1];
12478  SoundSpeed = sqrt(Gamma*Pressure/Density);
12479  Entropy = Pressure*pow(1.0/Density, Gamma);
12480  Riemann = Vn + 2.0*SoundSpeed/Gamma_Minus_One;
12481 
12482  /*--- Compute the new fictious state at the outlet ---*/
12483 
12484  Density = pow(Inflow_Pressure/Entropy,1.0/Gamma);
12485  Pressure = Inflow_Pressure;
12486  SoundSpeed = sqrt(Gamma*Inflow_Pressure/Density);
12487  Vn_Exit = Riemann - 2.0*SoundSpeed/Gamma_Minus_One;
12488  Velocity2 = 0.0;
12489  for (iDim = 0; iDim < nDim; iDim++) {
12490  Velocity[iDim] = Velocity[iDim] + (Vn_Exit-Vn)*UnitNormal[iDim];
12491  Velocity2 += Velocity[iDim]*Velocity[iDim];
12492  }
12493 
12494  Energy = Inflow_Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2;
12495  if (tkeNeeded) Energy += GetTke_Inf();
12496 
12497  /*--- Conservative variables, using the derived quantities ---*/
12498 
12499  V_inflow[0] = Pressure / ( Gas_Constant * Density);
12500  for (iDim = 0; iDim < nDim; iDim++)
12501  V_inflow[iDim+1] = Velocity[iDim];
12502  V_inflow[nDim+1] = Pressure;
12503  V_inflow[nDim+2] = Density;
12504  V_inflow[nDim+3] = Energy + Pressure/Density;
12505  V_inflow[nDim+4] = SoundSpeed;
12506 
12507  /*--- Set various quantities in the solver class ---*/
12508 
12509  conv_numerics->SetNormal(Normal);
12510  conv_numerics->SetPrimitive(V_domain, V_inflow);
12511 
12512  /*--- Set grid movement ---*/
12513 
12514  if (grid_movement)
12515  conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
12516 
12517  /*--- Compute the residual using an upwind scheme ---*/
12518 
12519  conv_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
12520  LinSysRes.AddBlock(iPoint, Residual);
12521 
12522  /*--- Jacobian contribution for implicit integration ---*/
12523 
12524  if (implicit)
12525  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
12526 
12527 // /*--- Viscous contribution, commented out because serious convergence problems ---*/
12528 //
12529 // if (viscous) {
12530 //
12531 // /*--- Set laminar and eddy viscosity at the infinity ---*/
12532 //
12533 // V_inflow[nDim+5] = node[iPoint]->GetLaminarViscosity();
12534 // V_inflow[nDim+6] = node[iPoint]->GetEddyViscosity();
12535 //
12536 // /*--- Set the normal vector and the coordinates ---*/
12537 //
12538 // visc_numerics->SetNormal(Normal);
12539 // visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
12540 //
12541 // /*--- Primitive variables, and gradient ---*/
12542 //
12543 // visc_numerics->SetPrimitive(V_domain, V_inflow);
12544 // visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
12545 //
12546 // /*--- Turbulent kinetic energy ---*/
12547 //
12548 // if (config->GetKind_Turb_Model() == SST)
12549 // visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
12550 //
12551 // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
12552 //
12553 // visc_numerics->SetTauWall(-1.0, -1.0);
12554 //
12555 // /*--- Compute and update residual ---*/
12556 //
12557 // visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
12558 // LinSysRes.SubtractBlock(iPoint, Residual);
12559 //
12560 // /*--- Jacobian contribution for implicit integration ---*/
12561 //
12562 // if (implicit)
12563 // Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
12564 //
12565 // }
12566 
12567  }
12568  }
12569 
12570  delete [] Normal;
12571 
12572 }
12573 
12574 
12575 void CEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
12576 
12577  unsigned short iDim;
12578  unsigned long iVertex, iPoint;
12579  su2double Exhaust_Pressure, Exhaust_Temperature, Velocity[3], Velocity2, H_Exhaust, Temperature, Riemann, Area, UnitNormal[3], Pressure, Density, Energy, Mach2, SoundSpeed2, SoundSpeed_Exhaust2, Vel_Mag, alpha, aa, bb, cc, dd, Flow_Dir[3];
12580  su2double *V_exhaust, *V_domain, Target_Exhaust_Pressure, Exhaust_Pressure_old, Exhaust_Pressure_inc;
12581 
12582  su2double Gas_Constant = config->GetGas_ConstantND();
12583  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
12584  bool grid_movement = config->GetGrid_Movement();
12585  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
12586  bool tkeNeeded = (((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS)) &&
12587  (config->GetKind_Turb_Model() == SST));
12588  su2double DampingFactor = config->GetDamp_Engine_Exhaust();
12589  su2double Baseline_Press = 0.75 * config->GetPressure_FreeStreamND();
12590 
12591  su2double *Normal = new su2double[nDim];
12592 
12593  /*--- Retrieve the specified exhaust pressure in the engine (non-dimensional). ---*/
12594 
12595  Target_Exhaust_Pressure = config->GetExhaust_Pressure_Target(Marker_Tag) / config->GetPressure_Ref();
12596 
12597  /*--- Retrieve the old exhaust pressure in the engine exhaust (this has been computed in a preprocessing). ---*/
12598 
12599  Exhaust_Pressure_old = config->GetExhaust_Pressure(Marker_Tag);
12600 
12601  /*--- Compute the Pressure increment ---*/
12602 
12603  Exhaust_Pressure_inc = (1.0 - (Exhaust_Pressure_old/Target_Exhaust_Pressure)) * Baseline_Press;
12604 
12605  /*--- Estimate the new exhaust pressure ---*/
12606 
12607  Exhaust_Pressure = (1.0 - DampingFactor) * Exhaust_Pressure_old + DampingFactor * (Exhaust_Pressure_old + Exhaust_Pressure_inc);
12608 
12609  /*--- The temperature is given (no iteration is required) ---*/
12610 
12611  Exhaust_Temperature = config->GetExhaust_Temperature_Target(Marker_Tag);
12613 
12614  /*--- The pressure is given (no iteration is required) ---*/
12615 
12616  Exhaust_Pressure = config->GetExhaust_Pressure_Target(Marker_Tag);
12617  Exhaust_Pressure /= config->GetPressure_Ref();
12618 
12619  /*--- Loop over all the vertices on this boundary marker ---*/
12620 
12621  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
12622 
12623  /*--- Allocate the value at the exhaust ---*/
12624 
12625  V_exhaust = GetCharacPrimVar(val_marker, iVertex);
12626 
12627  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
12628 
12629  /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
12630 
12631  if (geometry->node[iPoint]->GetDomain()) {
12632 
12633  /*--- Normal vector for this vertex (negate for outward convention) ---*/
12634 
12635  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
12636  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
12637 
12638  Area = 0.0;
12639  for (iDim = 0; iDim < nDim; iDim++)
12640  Area += Normal[iDim]*Normal[iDim];
12641  Area = sqrt (Area);
12642 
12643  for (iDim = 0; iDim < nDim; iDim++)
12644  UnitNormal[iDim] = Normal[iDim]/Area;
12645 
12646  /*--- Current solution at this boundary node ---*/
12647 
12648  V_domain = node[iPoint]->GetPrimitive();
12649 
12650  /*--- Subsonic inflow: there is one outgoing characteristic (u-c),
12651  therefore we can specify all but one state variable at the inlet.
12652  The outgoing Riemann invariant provides the final piece of info. ---*/
12653 
12654  /*--- Store primitives and set some variables for clarity. ---*/
12655 
12656  Density = V_domain[nDim+2];
12657  Velocity2 = 0.0;
12658  for (iDim = 0; iDim < nDim; iDim++) {
12659  Velocity[iDim] = V_domain[iDim+1];
12660  Velocity2 += Velocity[iDim]*Velocity[iDim];
12661  }
12662  Energy = V_domain[nDim+3] - V_domain[nDim+1]/V_domain[nDim+2];
12663  Pressure = V_domain[nDim+1];
12664  H_Exhaust = (Gamma*Gas_Constant/Gamma_Minus_One)*Exhaust_Temperature;
12665  SoundSpeed2 = Gamma*Pressure/Density;
12666 
12667  /*--- Compute the acoustic Riemann invariant that is extrapolated
12668  from the domain interior. ---*/
12669 
12670  Riemann = 2.0*sqrt(SoundSpeed2)/Gamma_Minus_One;
12671  for (iDim = 0; iDim < nDim; iDim++)
12672  Riemann += Velocity[iDim]*UnitNormal[iDim];
12673 
12674  /*--- Total speed of sound ---*/
12675 
12676  SoundSpeed_Exhaust2 = Gamma_Minus_One*(H_Exhaust - (Energy + Pressure/Density)+0.5*Velocity2) + SoundSpeed2;
12677 
12678  /*--- The flow direction is defined by the surface normal ---*/
12679 
12680  for (iDim = 0; iDim < nDim; iDim++)
12681  Flow_Dir[iDim] = -UnitNormal[iDim];
12682 
12683  /*--- Dot product of normal and flow direction. This should
12684  be negative due to outward facing boundary normal convention. ---*/
12685 
12686  alpha = 0.0;
12687  for (iDim = 0; iDim < nDim; iDim++)
12688  alpha += UnitNormal[iDim]*Flow_Dir[iDim];
12689 
12690  /*--- Coefficients in the quadratic equation for the velocity ---*/
12691 
12692  aa = 1.0 + 0.5*Gamma_Minus_One*alpha*alpha;
12693  bb = -1.0*Gamma_Minus_One*alpha*Riemann;
12694  cc = 0.5*Gamma_Minus_One*Riemann*Riemann - 2.0*SoundSpeed_Exhaust2/Gamma_Minus_One;
12695 
12696  /*--- Solve quadratic equation for velocity magnitude. Value must
12697  be positive, so the choice of root is clear. ---*/
12698 
12699  dd = bb*bb - 4.0*aa*cc;
12700  dd = sqrt(max(0.0, dd));
12701  Vel_Mag = (-bb + dd)/(2.0*aa);
12702 
12703  if (Vel_Mag >= 0.0) {
12704 
12705  Velocity2 = Vel_Mag*Vel_Mag;
12706 
12707  /*--- Compute speed of sound from total speed of sound eqn. ---*/
12708 
12709  SoundSpeed2 = SoundSpeed_Exhaust2 - 0.5*Gamma_Minus_One*Velocity2;
12710  Mach2 = Velocity2/SoundSpeed2;
12711  Velocity2 = Mach2*SoundSpeed2;
12712  Vel_Mag = sqrt(Velocity2);
12713  SoundSpeed2 = SoundSpeed_Exhaust2 - 0.5*Gamma_Minus_One*Velocity2;
12714 
12715  /*--- Compute new velocity vector at the inlet ---*/
12716 
12717  for (iDim = 0; iDim < nDim; iDim++)
12718  Velocity[iDim] = Vel_Mag*Flow_Dir[iDim];
12719 
12720  /*--- Static temperature from the speed of sound relation ---*/
12721 
12722  Temperature = SoundSpeed2/(Gamma*Gas_Constant);
12723 
12724  /*--- Static pressure using isentropic relation at a point ---*/
12725 
12726  Pressure = Exhaust_Pressure*pow((Temperature/Exhaust_Temperature), Gamma/Gamma_Minus_One);
12727 
12728  /*--- Density at the exhaust from the gas law ---*/
12729 
12730  Density = Pressure/(Gas_Constant*Temperature);
12731 
12732  /*--- Using pressure, density, & velocity, compute the energy ---*/
12733 
12734  Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2;
12735  if (tkeNeeded) Energy += GetTke_Inf();
12736 
12737  /*--- Primitive variables, using the derived quantities ---*/
12738 
12739  V_exhaust[0] = Temperature;
12740  for (iDim = 0; iDim < nDim; iDim++)
12741  V_exhaust[iDim+1] = Velocity[iDim];
12742  V_exhaust[nDim+1] = Pressure;
12743  V_exhaust[nDim+2] = Density;
12744  V_exhaust[nDim+3] = Energy + Pressure/Density;
12745  V_exhaust[nDim+4] = sqrt(SoundSpeed2);
12746 
12747  }
12748  /*--- The flow goes in the wrong direction ---*/
12749 
12750  else {
12751 
12752  V_exhaust[0] = V_domain[0];
12753  for (iDim = 0; iDim < nDim; iDim++)
12754  V_exhaust[iDim+1] = V_domain[iDim+1];
12755  V_exhaust[nDim+1] = V_domain[nDim+1];
12756  V_exhaust[nDim+2] = V_domain[nDim+2];
12757  V_exhaust[nDim+3] = V_domain[nDim+3];
12758  V_exhaust[nDim+4] = V_domain[nDim+4];
12759 
12760  }
12761 
12762  /*--- Set various quantities in the solver class ---*/
12763 
12764  conv_numerics->SetNormal(Normal);
12765  conv_numerics->SetPrimitive(V_domain, V_exhaust);
12766 
12767  /*--- Set grid movement ---*/
12768 
12769  if (grid_movement)
12770  conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
12771 
12772  /*--- Compute the residual using an upwind scheme ---*/
12773 
12774  conv_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
12775  LinSysRes.AddBlock(iPoint, Residual);
12776 
12777  /*--- Jacobian contribution for implicit integration ---*/
12778 
12779  if (implicit)
12780  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
12781 
12782 // /*--- Viscous contribution, commented out because serious convergence problems ---*/
12783 //
12784 // if (viscous) {
12785 //
12786 // /*--- Set laminar and eddy viscosity at the infinity ---*/
12787 //
12788 // V_exhaust[nDim+5] = node[iPoint]->GetLaminarViscosity();
12789 // V_exhaust[nDim+6] = node[iPoint]->GetEddyViscosity();
12790 //
12791 // /*--- Set the normal vector and the coordinates ---*/
12792 //
12793 // visc_numerics->SetNormal(Normal);
12794 // visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
12795 //
12796 // /*--- Primitive variables, and gradient ---*/
12797 //
12798 // visc_numerics->SetPrimitive(V_domain, V_exhaust);
12799 // visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
12800 //
12801 // /*--- Turbulent kinetic energy ---*/
12802 //
12803 // if (config->GetKind_Turb_Model() == SST)
12804 // visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
12805 //
12806 // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
12807 //
12808 // visc_numerics->SetTauWall(-1.0, -1.0);
12809 //
12810 // /*--- Compute and update residual ---*/
12811 //
12812 // visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
12813 // LinSysRes.SubtractBlock(iPoint, Residual);
12814 //
12815 // /*--- Jacobian contribution for implicit integration ---*/
12816 //
12817 // if (implicit)
12818 // Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
12819 //
12820 // }
12821 
12822  }
12823  }
12824 
12825  delete [] Normal;
12826 
12827 }
12828 
12829 void CEulerSolver::BC_Sym_Plane(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
12830  CConfig *config, unsigned short val_marker) {
12831 
12832  /*--- Call the Euler residual ---*/
12833 
12834  BC_Euler_Wall(geometry, solver_container, conv_numerics, config, val_marker);
12835 
12836 }
12837 
12838 void CEulerSolver::BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
12839  CConfig *config) {
12840 
12841  unsigned long iVertex, jVertex, iPoint, Point_Normal = 0;
12842  unsigned short iDim, iVar, iMarker, nDonorVertex;
12843 
12844  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
12845  bool grid_movement = config->GetGrid_Movement();
12846  bool viscous = config->GetViscous();
12847 
12848  su2double *Normal = new su2double[nDim];
12851  su2double *tmp_residual = new su2double[nVar];
12852 
12853  su2double weight;
12854  su2double P_static, rho_static;
12855 
12856  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
12857 
12858  if (config->GetMarker_All_KindBC(iMarker) == FLUID_INTERFACE) {
12859 
12860  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
12861  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
12862 
12863  if (geometry->node[iPoint]->GetDomain()) {
12864 
12865  nDonorVertex = GetnSlidingStates(iMarker, iVertex);
12866 
12867  /*--- Initialize Residual, this will serve to accumulate the average ---*/
12868 
12869  for (iVar = 0; iVar < nVar; iVar++)
12870  Residual[iVar] = 0.0;
12871 
12872  /*--- Loop over the nDonorVertexes and compute the averaged flux ---*/
12873 
12874  for (jVertex = 0; jVertex < nDonorVertex; jVertex++){
12875 
12876  Point_Normal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
12877 
12878  for (iVar = 0; iVar < nPrimVar; iVar++) {
12879  PrimVar_i[iVar] = node[iPoint]->GetPrimitive(iVar);
12880  PrimVar_j[iVar] = GetSlidingState(iMarker, iVertex, iVar, jVertex);
12881  }
12882 
12883  /*--- Get the weight computed in the interpolator class for the j-th donor vertex ---*/
12884 
12885  weight = GetSlidingState(iMarker, iVertex, nPrimVar, jVertex);
12886 
12887  /*--- Set primitive variables ---*/
12888 
12889  conv_numerics->SetPrimitive( PrimVar_i, PrimVar_j );
12890 
12891  if( !( config->GetKind_FluidModel() == STANDARD_AIR || config->GetKind_FluidModel() == IDEAL_GAS ) ) {
12892  Secondary_i = node[iPoint]->GetSecondary();
12893 
12894  P_static = PrimVar_j[nDim+1];
12895  rho_static = PrimVar_j[nDim+2];
12896  FluidModel->SetTDState_Prho(P_static, rho_static);
12897 
12900 
12901  conv_numerics->SetSecondary(Secondary_i, Secondary_j);
12902  }
12903 
12904  /*--- Set the normal vector ---*/
12905 
12906  geometry->vertex[iMarker][iVertex]->GetNormal(Normal);
12907  for (iDim = 0; iDim < nDim; iDim++)
12908  Normal[iDim] = -Normal[iDim];
12909 
12910  conv_numerics->SetNormal(Normal);
12911 
12912  if (grid_movement)
12913  conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
12914 
12915  /*--- Compute the convective residual using an upwind scheme ---*/
12916 
12917  conv_numerics->ComputeResidual(tmp_residual, Jacobian_i, Jacobian_j, config);
12918 
12919  /*--- Accumulate the residuals to compute the average ---*/
12920 
12921  for (iVar = 0; iVar < nVar; iVar++)
12922  Residual[iVar] += weight*tmp_residual[iVar];
12923 
12924  }
12925 
12926  /*--- Add Residuals and Jacobians ---*/
12927 
12928  LinSysRes.AddBlock(iPoint, Residual);
12929  if (implicit)
12930  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
12931 
12932  if (viscous) {
12933 
12934  /*--- Initialize Residual, this will serve to accumulate the average ---*/
12935 
12936  for (iVar = 0; iVar < nVar; iVar++)
12937  Residual[iVar] = 0.0;
12938 
12939  /*--- Loop over the nDonorVertexes and compute the averaged flux ---*/
12940 
12941  for (jVertex = 0; jVertex < nDonorVertex; jVertex++){
12942  PrimVar_j[nDim+5] = GetSlidingState(iMarker, iVertex, nDim+5, jVertex);
12943  PrimVar_j[nDim+6] = GetSlidingState(iMarker, iVertex, nDim+6, jVertex);
12944 
12945  /*--- Get the weight computed in the interpolator class for the j-th donor vertex ---*/
12946 
12947  weight = GetSlidingState(iMarker, iVertex, nPrimVar, jVertex);
12948 
12949  /*--- Set the normal vector and the coordinates ---*/
12950 
12951  visc_numerics->SetNormal(Normal);
12952  visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[Point_Normal]->GetCoord());
12953 
12954  /*--- Primitive variables, and gradient ---*/
12955 
12956  visc_numerics->SetPrimitive(PrimVar_i, PrimVar_j);
12957  visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
12958 
12959  /*--- Turbulent kinetic energy ---*/
12960 
12961  if (config->GetKind_Turb_Model() == SST)
12962  visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
12963 
12964  /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
12965 
12966  visc_numerics->SetTauWall(-1.0, -1.0);
12967 
12968  /*--- Compute and update residual ---*/
12969 
12970  visc_numerics->ComputeResidual(tmp_residual, Jacobian_i, Jacobian_j, config);
12971 
12972  /*--- Accumulate the residuals to compute the average ---*/
12973 
12974  for (iVar = 0; iVar < nVar; iVar++)
12975  Residual[iVar] += weight*tmp_residual[iVar];
12976  }
12977 
12978  LinSysRes.SubtractBlock(iPoint, Residual);
12979 
12980  /*--- Jacobian contribution for implicit integration ---*/
12981 
12982  if (implicit)
12983  Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
12984 
12985  }
12986  }
12987  }
12988  }
12989  }
12990 
12991  /*--- Free locally allocated memory ---*/
12992 
12993  delete [] tmp_residual;
12994  delete [] Normal;
12995  delete [] PrimVar_i;
12996  delete [] PrimVar_j;
12997 }
12998 
12999 void CEulerSolver::BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics,
13000  CConfig *config, unsigned short val_marker) {
13001 
13002  unsigned long iVertex, iPoint, GlobalIndex_iPoint, GlobalIndex_jPoint;
13003  unsigned short iDim, iVar;
13004 
13005  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
13006 
13007  su2double *Normal = new su2double[nDim];
13010 
13011  /*--- Do the send process, by the moment we are sending each
13012  node individually, this must be changed ---*/
13013 
13014  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
13015 
13016  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
13017  GlobalIndex_iPoint = geometry->node[iPoint]->GetGlobalIndex();
13018  GlobalIndex_jPoint = GetDonorGlobalIndex(val_marker, iVertex);
13019 
13020  if ((geometry->node[iPoint]->GetDomain()) && (GlobalIndex_iPoint != GlobalIndex_jPoint)) {
13021 
13022  /*--- Store the solution for both points ---*/
13023 
13024  for (iVar = 0; iVar < nPrimVar; iVar++) {
13025  PrimVar_i[iVar] = node[iPoint]->GetPrimitive(iVar);
13026  PrimVar_j[iVar] = GetDonorPrimVar(val_marker, iVertex, iVar);
13027  }
13028 
13029  /*--- Set Conservative Variables ---*/
13030 
13031  numerics->SetPrimitive(PrimVar_i, PrimVar_j);
13032 
13033  /*--- Set Normal ---*/
13034 
13035  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
13036  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
13037  numerics->SetNormal(Normal);
13038 
13039  /*--- Compute the convective residual using an upwind scheme ---*/
13040 
13041  numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
13042 
13043  /*--- Add Residuals and Jacobians ---*/
13044 
13045  LinSysRes.AddBlock(iPoint, Residual);
13046  if (implicit) Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
13047 
13048  }
13049 
13050  }
13051 
13052  /*--- Free locally allocated memory ---*/
13053 
13054  delete [] Normal;
13055  delete [] PrimVar_i;
13056  delete [] PrimVar_j;
13057 
13058 }
13059 
13060 void CEulerSolver::BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics,
13061  CConfig *config, unsigned short val_marker) {
13062 
13063  unsigned long iVertex, iPoint, GlobalIndex_iPoint, GlobalIndex_jPoint;
13064  unsigned short iDim, iVar;
13065 
13066  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
13067 
13068  su2double *Normal = new su2double[nDim];
13071 
13072  /*--- Do the send process, by the moment we are sending each
13073  node individually, this must be changed ---*/
13074 
13075  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
13076 
13077  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
13078  GlobalIndex_iPoint = geometry->node[iPoint]->GetGlobalIndex();
13079  GlobalIndex_jPoint = GetDonorGlobalIndex(val_marker, iVertex);
13080 
13081  if ((geometry->node[iPoint]->GetDomain()) && (GlobalIndex_iPoint != GlobalIndex_jPoint)) {
13082 
13083  /*--- Store the solution for both points ---*/
13084 
13085  for (iVar = 0; iVar < nPrimVar; iVar++) {
13086  PrimVar_i[iVar] = node[iPoint]->GetPrimitive(iVar);
13087  PrimVar_j[iVar] = GetDonorPrimVar(val_marker, iVertex, iVar);
13088  }
13089 
13090  /*--- Set Conservative Variables ---*/
13091 
13092  numerics->SetPrimitive(PrimVar_i, PrimVar_j);
13093 
13094  /*--- Set Normal ---*/
13095 
13096  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
13097  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
13098  numerics->SetNormal(Normal);
13099 
13100  /*--- Compute the convective residual using an upwind scheme ---*/
13101 
13102  numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
13103 
13104  /*--- Add Residuals and Jacobians ---*/
13105 
13106  LinSysRes.AddBlock(iPoint, Residual);
13107  if (implicit) Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
13108 
13109  }
13110 
13111  }
13112 
13113  /*--- Free locally allocated memory ---*/
13114 
13115  delete [] Normal;
13116  delete [] PrimVar_i;
13117  delete [] PrimVar_j;
13118 
13119 }
13120 
13121 void CEulerSolver::BC_ActDisk_Inlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
13122  CConfig *config, unsigned short val_marker) {
13123 
13124  BC_ActDisk(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true);
13125 
13126 }
13127 
13128 void CEulerSolver::BC_ActDisk_Outlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
13129  CConfig *config, unsigned short val_marker) {
13130 
13131  BC_ActDisk(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false);
13132 
13133 }
13134 
13135 void CEulerSolver::BC_ActDisk(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics,
13136  CConfig *config, unsigned short val_marker, bool val_inlet_surface) {
13137 
13138  unsigned short iDim;
13139  unsigned long iVertex, iPoint, GlobalIndex_donor, GlobalIndex;
13140  su2double Pressure, Velocity[3], Target_Press_Jump, Target_Temp_Jump,
13141  Velocity2, Entropy, Density, Energy, Riemann, Vn, SoundSpeed, Vn_Inlet, Mach_Outlet,
13142  Area, UnitNormal[3], *V_outlet, *V_domain, *V_inlet, P_Total, T_Total, H_Total, Temperature,
13143  Mach2, SoundSpeed2, SoundSpeed_Total2, Vel_Mag, alpha, aa, bb, cc, dd;
13144  su2double Factor, P_static, T_static, SoS_outlet, Rho_outlet, Rho_inlet;
13145  su2double Vel_normal_inlet[3], Vel_tangent_inlet[3], Vel_inlet[3];
13146  su2double Vel_normal_outlet[3], Vel_tangent_outlet[3], Vel_outlet[3];
13147  su2double Vel_normal_inlet_, Vel_tangent_inlet_, Vel_inlet_;
13148  su2double Vel_normal_outlet_, Vel_outlet_;
13149 
13150  su2double Pressure_out, Density_out, SoundSpeed_out, Velocity2_out,
13151  Mach_out, Pressure_in, Density_in, SoundSpeed_in, Velocity2_in,
13152  Mach_in, PressureAdj, TemperatureAdj;
13153 
13154  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
13155  su2double Gas_Constant = config->GetGas_ConstantND();
13156  bool grid_movement = config->GetGrid_Movement();
13157  bool tkeNeeded = (((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS)) &&
13158  (config->GetKind_Turb_Model() == SST));
13159  bool ratio = (config->GetActDisk_Jump() == RATIO);
13160  su2double SecondaryFlow = config->GetSecondaryFlow_ActDisk();
13161 
13162  su2double *Normal = new su2double[nDim];
13163  su2double *Flow_Dir = new su2double[nDim];
13164 
13165  /*--- Loop over all the vertices on this boundary marker ---*/
13166 
13167  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
13168 
13169  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
13170  GlobalIndex = geometry->node[iPoint]->GetGlobalIndex();
13171  GlobalIndex_donor = GetDonorGlobalIndex(val_marker, iVertex);
13172 
13173  /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/
13174 
13175  if ((geometry->node[iPoint]->GetDomain()) &&
13176  (GlobalIndex != GlobalIndex_donor)) {
13177 
13178  /*--- Normal vector for this vertex (negative for outward convention) ---*/
13179 
13180  geometry->vertex[val_marker][iVertex]->GetNormal(Normal);
13181  for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
13182  conv_numerics->SetNormal(Normal);
13183 
13184  Area = 0.0;
13185  for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
13186  Area = sqrt (Area);
13187 
13188  for (iDim = 0; iDim < nDim; iDim++)
13189  UnitNormal[iDim] = Normal[iDim]/Area;
13190 
13191  /*--- Current solution at this boundary node and jumps values ---*/
13192 
13193  V_domain = node[iPoint]->GetPrimitive();
13194  Target_Press_Jump = GetActDisk_DeltaP(val_marker, iVertex);
13195  Target_Temp_Jump = GetActDisk_DeltaT(val_marker, iVertex);
13196 
13197  if (val_inlet_surface) {
13198  V_inlet = node[iPoint]->GetPrimitive();
13199  V_outlet = GetDonorPrimVar(val_marker, iVertex);
13200 
13201  Pressure_out = V_outlet[nDim+1];
13202  Density_out = V_outlet[nDim+2];
13203  SoundSpeed_out = sqrt(Gamma*Pressure_out/Density_out);
13204 
13205  Pressure_in = V_inlet[nDim+1];
13206  Density_in = V_inlet[nDim+2];
13207  SoundSpeed_in = sqrt(Gamma*Pressure_in/Density_in);
13208 
13209  Velocity2_out = 0.0; Velocity2_in = 0.0;
13210  for (iDim = 0; iDim < nDim; iDim++) {
13211  Velocity2_out += V_outlet[iDim+1]*V_outlet[iDim+1];
13212  Velocity2_in += V_inlet[iDim+1]*V_inlet[iDim+1];
13213  }
13214 
13215  PressureAdj = 1.0; TemperatureAdj = 1.0;
13216  if ((Velocity2_out > 0.0) && (Velocity2_in > 0.0)) {
13217 
13218  Mach_out = sqrt(Velocity2_out)/SoundSpeed_out;
13219  Mach_in = sqrt(Velocity2_in)/SoundSpeed_in;
13220 
13221  PressureAdj = pow( 1.0 + Mach_out * Mach_out * 0.5 * (Gamma - 1.0), Gamma / (Gamma - 1.0)) /
13222  pow( 1.0 + Mach_in * Mach_in * 0.5 * (Gamma - 1.0), Gamma / (Gamma - 1.0));
13223  TemperatureAdj = (1.0 + Mach_out * Mach_out * 0.5 * (Gamma - 1.0)) /
13224  (1.0 + Mach_in * Mach_in * 0.5 * (Gamma - 1.0));
13225 
13226  }
13227 
13228  if (ratio) {
13229  P_static = V_outlet[nDim+1] / (Target_Press_Jump/PressureAdj);
13230  T_static = V_outlet[0] / (Target_Temp_Jump/TemperatureAdj);
13231  }
13232  else { P_static = V_outlet[nDim+1] - Target_Press_Jump; T_static = V_outlet[0] - Target_Temp_Jump; }
13233  }
13234  else {
13235  V_outlet = node[iPoint]->GetPrimitive();
13236  V_inlet = GetDonorPrimVar(val_marker, iVertex);
13237 
13238  Pressure_out = V_outlet[nDim+1];
13239  Density_out = V_outlet[nDim+2];
13240  SoundSpeed_out = sqrt(Gamma*Pressure_out/Density_out);
13241 
13242  Pressure_in = V_inlet[nDim+1];
13243  Density_in = V_inlet[nDim+2];
13244  SoundSpeed_in = sqrt(Gamma*Pressure_in/Density_in);
13245 
13246  Velocity2_out = 0.0; Velocity2_in = 0.0;
13247  for (iDim = 0; iDim < nDim; iDim++) {
13248  Velocity2_out += V_outlet[iDim+1]*V_outlet[iDim+1];
13249  Velocity2_in += V_inlet[iDim+1]*V_inlet[iDim+1];
13250  }
13251 
13252  PressureAdj = 1.0; TemperatureAdj = 1.0;
13253  if ((Velocity2_out > 0.0) && (Velocity2_in > 0.0)) {
13254 
13255  Mach_out = sqrt(Velocity2_out)/SoundSpeed_out;
13256  Mach_in = sqrt(Velocity2_in)/SoundSpeed_in;
13257 
13258  PressureAdj = pow( 1.0 + Mach_out * Mach_out * 0.5 * (Gamma - 1.0), Gamma / (Gamma - 1.0)) /
13259  pow( 1.0 + Mach_in * Mach_in * 0.5 * (Gamma - 1.0), Gamma / (Gamma - 1.0));
13260  TemperatureAdj = (1.0 + Mach_out * Mach_out * 0.5 * (Gamma - 1.0)) /
13261  (1.0 + Mach_in * Mach_in * 0.5 * (Gamma - 1.0));
13262  }
13263 
13264  if (ratio) {
13265  P_static = V_inlet[nDim+1] * (Target_Press_Jump/PressureAdj);
13266  T_static = V_inlet[0] * (Target_Temp_Jump/TemperatureAdj);
13267  }
13268  else { P_static = V_inlet[nDim+1] + Target_Press_Jump; T_static = V_inlet[0] + Target_Temp_Jump; }
13269  }
13270 
13271  /*--- Subsonic inlet ---*/
13272 
13273  if (val_inlet_surface) {
13274 
13275  /*--- Build the fictitious intlet state based on characteristics.
13276  Retrieve the specified back pressure for this inlet ---*/
13277 
13278  Density = V_domain[nDim+2];
13279  Velocity2 = 0.0; Vn = 0.0;
13280  for (iDim = 0; iDim < nDim; iDim++) {
13281  Velocity[iDim] = V_domain[iDim+1];
13282  Velocity2 += Velocity[iDim]*Velocity[iDim];
13283  Vn += Velocity[iDim]*UnitNormal[iDim];
13284  }
13285  Pressure = V_domain[nDim+1];
13286  SoundSpeed = sqrt(Gamma*Pressure/Density);
13287 
13288  Entropy = Pressure*pow(1.0/Density, Gamma);
13289  Riemann = Vn + 2.0*SoundSpeed/Gamma_Minus_One;
13290 
13291  /*--- Compute the new fictious state at the outlet ---*/
13292 
13293  Pressure = P_static;
13294  Density = pow(Pressure/Entropy,1.0/Gamma);
13295  SoundSpeed = sqrt(Gamma*Pressure/Density);
13296  Vn_Inlet = Riemann - 2.0*SoundSpeed/Gamma_Minus_One;
13297 
13298  Velocity2 = 0.0;
13299  for (iDim = 0; iDim < nDim; iDim++) {
13300  Velocity[iDim] = Velocity[iDim] + (Vn_Inlet-Vn)*UnitNormal[iDim];
13301  Velocity2 += Velocity[iDim]*Velocity[iDim];
13302  }
13303  Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2;
13304  if (tkeNeeded) Energy += GetTke_Inf();
13305 
13306  /*--- Conservative variables, using the derived quantities ---*/
13307 
13308  V_inlet[0] = Pressure / ( Gas_Constant * Density);
13309  for (iDim = 0; iDim < nDim; iDim++)
13310  V_inlet[iDim+1] = Velocity[iDim];
13311  V_inlet[nDim+1] = Pressure;
13312  V_inlet[nDim+2] = Density;
13313  V_inlet[nDim+3] = Energy + Pressure/Density;
13314  V_inlet[nDim+4] = SoundSpeed;
13315  conv_numerics->SetPrimitive(V_domain, V_inlet);
13316 
13317  }
13318 
13319  /*--- Subsonic outlet ---*/
13320 
13321  else {
13322 
13323  FluidModel->SetTDState_PT(P_static, T_static);
13324  SoS_outlet = FluidModel->GetSoundSpeed();
13325  Rho_outlet = FluidModel->GetDensity();
13326 
13327  /*--- We use the velocity and the density from the flow inlet
13328  to evaluate flow direction and mass flow ---*/
13329 
13330  Rho_inlet = V_inlet[nDim+2];
13331  for (iDim = 0; iDim < nDim; iDim++)
13332  Vel_inlet[iDim] = V_inlet[iDim+1];
13333 
13334  Vel_normal_inlet_ = 0.0; Vel_inlet_ = 0.0;
13335  for (iDim = 0; iDim < nDim; iDim++) {
13336  Vel_normal_inlet[iDim] = -Vel_inlet[iDim]*UnitNormal[iDim];
13337  Vel_normal_inlet_ += Vel_normal_inlet[iDim]*Vel_normal_inlet[iDim];
13338  Vel_inlet_+= Vel_inlet[iDim]*Vel_inlet[iDim];
13339  }
13340  Vel_inlet_ = sqrt(Vel_inlet_);
13341  Vel_normal_inlet_ = sqrt(Vel_normal_inlet_);
13342 
13343  Vel_tangent_inlet_ = 0.0;
13344  for (iDim = 0; iDim < nDim; iDim++) {
13345  Vel_tangent_inlet[iDim] = Vel_inlet[iDim] - Vel_normal_inlet[iDim];
13346  Vel_tangent_inlet_ += Vel_tangent_inlet[iDim]*Vel_tangent_inlet[iDim];
13347  }
13348  Vel_tangent_inlet_ = sqrt(Vel_tangent_inlet_);
13349 
13350  /*--- Mass flow conservation (normal direction) and
13351  no jump in the tangential velocity ---*/
13352 
13353  Vel_normal_outlet_ = (1.0-SecondaryFlow/100.0)*(Rho_inlet*Vel_normal_inlet_)/Rho_outlet;
13354 
13355  Vel_outlet_ = 0.0;
13356  for (iDim = 0; iDim < nDim; iDim++) {
13357  Vel_normal_outlet[iDim] = -Vel_normal_outlet_*UnitNormal[iDim];
13358  Vel_tangent_outlet[iDim] = Vel_tangent_inlet[iDim];
13359  Vel_outlet[iDim] = Vel_normal_outlet[iDim] + Vel_tangent_outlet[iDim];
13360  Vel_outlet_ += Vel_outlet[iDim]*Vel_outlet[iDim];
13361  }
13362  Vel_outlet_ = sqrt(Vel_outlet_);
13363 
13364  Mach_Outlet = min(Vel_outlet_/SoS_outlet, 1.0);
13365 
13366  /*--- Reevaluate the Total Pressure and Total Temperature using the
13367  Fan Face Mach number and the static values from the jum condition ---*/
13368 
13369  Factor = 1.0 + 0.5*Mach_Outlet*Mach_Outlet*Gamma_Minus_One;
13370  P_Total = P_static * pow(Factor, Gamma/Gamma_Minus_One);
13371  T_Total = T_static * Factor;
13372 
13373  /*--- Flow direction using the velocity direction at the outlet ---*/
13374 
13375  if (Vel_outlet_ != 0.0) {
13376  for (iDim = 0; iDim < nDim; iDim++) Flow_Dir[iDim] = Vel_outlet[iDim]/Vel_outlet_;
13377  }
13378  else {
13379  for (iDim = 0; iDim < nDim; iDim++) Flow_Dir[iDim] = 0.0;
13380  }
13381 
13382  /*--- Store primitives and set some variables for clarity. ---*/
13383 
13384  Density = V_domain[nDim+2];
13385  Velocity2 = 0.0;
13386  for (iDim = 0; iDim < nDim; iDim++) {
13387  Velocity[iDim] = V_domain[iDim+1];
13388  Velocity2 += Velocity[iDim]*Velocity[iDim];
13389  }
13390  Energy = V_domain[nDim+3] - V_domain[nDim+1]/V_domain[nDim+2];
13391  Pressure = V_domain[nDim+1];
13392  H_Total = (Gamma*Gas_Constant/Gamma_Minus_One)*T_Total;
13393  SoundSpeed2 = Gamma*Pressure/Density;
13394 
13395  /*--- Compute the acoustic Riemann invariant that is extrapolated
13396  from the domain interior. ---*/
13397 
13398  Riemann = 2.0*sqrt(SoundSpeed2)/Gamma_Minus_One;
13399  for (iDim = 0; iDim < nDim; iDim++)
13400  Riemann += Velocity[iDim]*UnitNormal[iDim];
13401 
13402  /*--- Total speed of sound ---*/
13403 
13404  SoundSpeed_Total2 = Gamma_Minus_One*(H_Total - (Energy + Pressure/Density)+0.5*Velocity2) + SoundSpeed2;
13405 
13406  /*--- Dot product of normal and flow direction. This should
13407  be negative due to outward facing boundary normal convention. ---*/
13408 
13409  alpha = 0.0;
13410  for (iDim = 0; iDim < nDim; iDim++)
13411  alpha += UnitNormal[iDim]*Flow_Dir[iDim];
13412 
13413  /*--- Coefficients in the quadratic equation for the velocity ---*/
13414 
13415  aa = 1.0 + 0.5*Gamma_Minus_One*alpha*alpha;
13416  bb = -1.0*Gamma_Minus_One*alpha*Riemann;
13417  cc = 0.5*Gamma_Minus_One*Riemann*Riemann - 2.0*SoundSpeed_Total2/Gamma_Minus_One;
13418 
13419  /*--- Solve quadratic equation for velocity magnitude. Value must
13420  be positive, so the choice of root is clear. ---*/
13421 
13422  dd = bb*bb - 4.0*aa*cc;
13423  dd = sqrt(max(0.0, dd));
13424  Vel_Mag = (-bb + dd)/(2.0*aa);
13425  Vel_Mag = max(0.0, Vel_Mag);
13426  Velocity2 = Vel_Mag*Vel_Mag;
13427 
13428  /*--- Compute speed of sound from total speed of sound eqn. ---*/
13429 
13430  SoundSpeed2 = SoundSpeed_Total2 - 0.5*Gamma_Minus_One*Velocity2;
13431 
13432  /*--- Mach squared (cut between 0-1), use to adapt velocity ---*/
13433 
13434  Mach2 = min(1.0, Velocity2/SoundSpeed2);
13435  Velocity2 = Mach2*SoundSpeed2;
13436  Vel_Mag = sqrt(Velocity2);
13437  SoundSpeed2 = SoundSpeed_Total2 - 0.5*Gamma_Minus_One*Velocity2;
13438 
13439  /*--- Compute new velocity vector at the exit ---*/
13440 
13441  for (iDim = 0; iDim < nDim; iDim++)
13442  Velocity[iDim] = Vel_Mag*Flow_Dir[iDim];
13443 
13444  /*--- Static temperature from the speed of sound relation ---*/
13445 
13446  Temperature = SoundSpeed2/(Gamma*Gas_Constant);
13447 
13448  /*--- Static pressure using isentropic relation at a point ---*/
13449 
13450  Pressure = P_Total*pow((Temperature/T_Total), Gamma/Gamma_Minus_One);
13451 
13452  /*--- Density at the inlet from the gas law ---*/
13453 
13454  Density = Pressure/(Gas_Constant*Temperature);
13455 
13456  /*--- Using pressure, density, & velocity, compute the energy ---*/
13457 
13458  Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2;
13459  if (tkeNeeded) Energy += GetTke_Inf();
13460 
13461  /*--- Primitive variables, using the derived quantities ---*/
13462 
13463  V_outlet[0] = Temperature;
13464  for (iDim = 0; iDim < nDim; iDim++)
13465  V_outlet[iDim+1] = Velocity[iDim];
13466  V_outlet[nDim+1] = Pressure;
13467  V_outlet[nDim+2] = Density;
13468  V_outlet[nDim+3] = Energy + Pressure/Density;
13469  V_outlet[nDim+4] = sqrt(SoundSpeed2);
13470  conv_numerics->SetPrimitive(V_domain, V_outlet);
13471 
13472  }
13473 
13474  /*--- Grid Movement ---*/
13475 
13476  if (grid_movement)
13477  conv_numerics->SetGridVel(geometry->node[iPoint]->GetGridVel(), geometry->node[iPoint]->GetGridVel());
13478 
13479  /*--- Compute the residual using an upwind scheme ---*/
13480 
13481  conv_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
13482 
13483  /*--- Update residual value ---*/
13484 
13485  LinSysRes.AddBlock(iPoint, Residual);
13486 
13487  /*--- Jacobian contribution for implicit integration ---*/
13488 
13489  if (implicit) Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
13490 
13491 // /*--- Viscous contribution, commented out because serious convergence problems ---*/
13492 //
13493 // if (viscous) {
13494 //
13495 // /*--- Set laminar and eddy viscosity at the infinity ---*/
13496 //
13497 // if (val_inlet_surface) {
13498 // V_inlet[nDim+5] = node[iPoint]->GetLaminarViscosity();
13499 // V_inlet[nDim+6] = node[iPoint]->GetEddyViscosity();
13500 // }
13501 // else {
13502 // V_outlet[nDim+5] = node[iPoint]->GetLaminarViscosity();
13503 // V_outlet[nDim+6] = node[iPoint]->GetEddyViscosity();
13504 // }
13505 //
13506 // /*--- Set the normal vector and the coordinates ---*/
13507 //
13508 // visc_numerics->SetNormal(Normal);
13509 // visc_numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[iPoint_Normal]->GetCoord());
13510 //
13511 // /*--- Primitive variables, and gradient ---*/
13512 //
13513 // if (val_inlet_surface) visc_numerics->SetPrimitive(V_domain, V_inlet);
13514 // else visc_numerics->SetPrimitive(V_domain, V_outlet);
13515 //
13516 // visc_numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[iPoint]->GetGradient_Primitive());
13517 //
13518 // /*--- Turbulent kinetic energy ---*/
13519 //
13520 // if (config->GetKind_Turb_Model() == SST)
13521 // visc_numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0), solver_container[TURB_SOL]->node[iPoint]->GetSolution(0));
13522 //
13523 // /*--- Set the wall shear stress values (wall functions) to -1 (no evaluation using wall functions) ---*/
13524 //
13525 // visc_numerics->SetTauWall(-1.0, -1.0);
13526 //
13527 // /*--- Compute and update residual ---*/
13528 //
13529 // visc_numerics->ComputeResidual(Residual, Jacobian_i, Jacobian_j, config);
13530 // LinSysRes.SubtractBlock(iPoint, Residual);
13531 //
13532 // /*--- Jacobian contribution for implicit integration ---*/
13533 //
13534 // if (implicit) Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
13535 //
13536 // }
13537 
13538  }
13539 
13540  }
13541 
13542  /*--- Free locally allocated memory ---*/
13543 
13544  delete [] Normal;
13545  delete [] Flow_Dir;
13546 
13547 }
13548 
13549 void CEulerSolver::BC_Dirichlet(CGeometry *geometry, CSolver **solver_container,
13550  CConfig *config, unsigned short val_marker) { }
13551 
13552 void CEulerSolver::BC_Custom(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short val_marker) { }
13553 
13554 void CEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_container, CConfig *config,
13555  unsigned short iRKStep, unsigned short iMesh, unsigned short RunTime_EqSystem) {
13556 
13557  /*--- Local variables ---*/
13558 
13559  unsigned short iVar, jVar, iMarker, iDim;
13560  unsigned long iPoint, jPoint, iEdge, iVertex;
13561 
13562  su2double *U_time_nM1, *U_time_n, *U_time_nP1;
13563  su2double Volume_nM1, Volume_nP1, TimeStep;
13564  su2double *Normal = NULL, *GridVel_i = NULL, *GridVel_j = NULL, Residual_GCL;
13565 
13566  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
13567  bool grid_movement = config->GetGrid_Movement();
13568 
13569  /*--- Store the physical time step ---*/
13570 
13571  TimeStep = config->GetDelta_UnstTimeND();
13572 
13573  /*--- Compute the dual time-stepping source term for static meshes ---*/
13574 
13575  if (!grid_movement) {
13576 
13577  /*--- Loop over all nodes (excluding halos) ---*/
13578 
13579  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
13580 
13581  /*--- Retrieve the solution at time levels n-1, n, and n+1. Note that
13582  we are currently iterating on U^n+1 and that U^n & U^n-1 are fixed,
13583  previous solutions that are stored in memory. ---*/
13584 
13585  U_time_nM1 = node[iPoint]->GetSolution_time_n1();
13586  U_time_n = node[iPoint]->GetSolution_time_n();
13587  U_time_nP1 = node[iPoint]->GetSolution();
13588 
13589  /*--- CV volume at time n+1. As we are on a static mesh, the volume
13590  of the CV will remained fixed for all time steps. ---*/
13591 
13592  Volume_nP1 = geometry->node[iPoint]->GetVolume();
13593 
13594  /*--- Compute the dual time-stepping source term based on the chosen
13595  time discretization scheme (1st- or 2nd-order).---*/
13596 
13597  for (iVar = 0; iVar < nVar; iVar++) {
13598  if (config->GetUnsteady_Simulation() == DT_STEPPING_1ST)
13599  Residual[iVar] = (U_time_nP1[iVar] - U_time_n[iVar])*Volume_nP1 / TimeStep;
13600  if (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)
13601  Residual[iVar] = ( 3.0*U_time_nP1[iVar] - 4.0*U_time_n[iVar]
13602  +1.0*U_time_nM1[iVar])*Volume_nP1 / (2.0*TimeStep);
13603  }
13604 
13605  /*--- Store the residual and compute the Jacobian contribution due
13606  to the dual time source term. ---*/
13607 
13608  LinSysRes.AddBlock(iPoint, Residual);
13609  if (implicit) {
13610  for (iVar = 0; iVar < nVar; iVar++) {
13611  for (jVar = 0; jVar < nVar; jVar++) Jacobian_i[iVar][jVar] = 0.0;
13612  if (config->GetUnsteady_Simulation() == DT_STEPPING_1ST)
13613  Jacobian_i[iVar][iVar] = Volume_nP1 / TimeStep;
13614  if (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)
13615  Jacobian_i[iVar][iVar] = (Volume_nP1*3.0)/(2.0*TimeStep);
13616  }
13617  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
13618  }
13619  }
13620 
13621  }
13622 
13623  else {
13624 
13625  /*--- For unsteady flows on dynamic meshes (rigidly transforming or
13626  dynamically deforming), the Geometric Conservation Law (GCL) should be
13627  satisfied in conjunction with the ALE formulation of the governing
13628  equations. The GCL prevents accuracy issues caused by grid motion, i.e.
13629  a uniform free-stream should be preserved through a moving grid. First,
13630  we will loop over the edges and boundaries to compute the GCL component
13631  of the dual time source term that depends on grid velocities. ---*/
13632 
13633  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
13634 
13635  /*--- Get indices for nodes i & j plus the face normal ---*/
13636 
13637  iPoint = geometry->edge[iEdge]->GetNode(0);
13638  jPoint = geometry->edge[iEdge]->GetNode(1);
13639  Normal = geometry->edge[iEdge]->GetNormal();
13640 
13641  /*--- Grid velocities stored at nodes i & j ---*/
13642 
13643  GridVel_i = geometry->node[iPoint]->GetGridVel();
13644  GridVel_j = geometry->node[jPoint]->GetGridVel();
13645 
13646  /*--- Compute the GCL term by averaging the grid velocities at the
13647  edge mid-point and dotting with the face normal. ---*/
13648 
13649  Residual_GCL = 0.0;
13650  for (iDim = 0; iDim < nDim; iDim++)
13651  Residual_GCL += 0.5*(GridVel_i[iDim]+GridVel_j[iDim])*Normal[iDim];
13652 
13653  /*--- Compute the GCL component of the source term for node i ---*/
13654 
13655  U_time_n = node[iPoint]->GetSolution_time_n();
13656  for (iVar = 0; iVar < nVar; iVar++)
13657  Residual[iVar] = U_time_n[iVar]*Residual_GCL;
13658  LinSysRes.AddBlock(iPoint, Residual);
13659 
13660  /*--- Compute the GCL component of the source term for node j ---*/
13661 
13662  U_time_n = node[jPoint]->GetSolution_time_n();
13663  for (iVar = 0; iVar < nVar; iVar++)
13664  Residual[iVar] = U_time_n[iVar]*Residual_GCL;
13665  LinSysRes.SubtractBlock(jPoint, Residual);
13666 
13667  }
13668 
13669  /*--- Loop over the boundary edges ---*/
13670 
13671  for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
13672  if (config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY)
13673  for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
13674 
13675  /*--- Get the index for node i plus the boundary face normal ---*/
13676 
13677  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
13678  Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
13679 
13680  /*--- Grid velocities stored at boundary node i ---*/
13681 
13682  GridVel_i = geometry->node[iPoint]->GetGridVel();
13683 
13684  /*--- Compute the GCL term by dotting the grid velocity with the face
13685  normal. The normal is negated to match the boundary convention. ---*/
13686 
13687  Residual_GCL = 0.0;
13688  for (iDim = 0; iDim < nDim; iDim++)
13689  Residual_GCL -= 0.5*(GridVel_i[iDim]+GridVel_i[iDim])*Normal[iDim];
13690 
13691  /*--- Compute the GCL component of the source term for node i ---*/
13692 
13693  U_time_n = node[iPoint]->GetSolution_time_n();
13694  for (iVar = 0; iVar < nVar; iVar++)
13695  Residual[iVar] = U_time_n[iVar]*Residual_GCL;
13696  LinSysRes.AddBlock(iPoint, Residual);
13697 
13698  }
13699  }
13700 
13701  /*--- Loop over all nodes (excluding halos) to compute the remainder
13702  of the dual time-stepping source term. ---*/
13703 
13704  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
13705 
13706  /*--- Retrieve the solution at time levels n-1, n, and n+1. Note that
13707  we are currently iterating on U^n+1 and that U^n & U^n-1 are fixed,
13708  previous solutions that are stored in memory. ---*/
13709 
13710  U_time_nM1 = node[iPoint]->GetSolution_time_n1();
13711  U_time_n = node[iPoint]->GetSolution_time_n();
13712  U_time_nP1 = node[iPoint]->GetSolution();
13713 
13714  /*--- CV volume at time n-1 and n+1. In the case of dynamically deforming
13715  grids, the volumes will change. On rigidly transforming grids, the
13716  volumes will remain constant. ---*/
13717 
13718  Volume_nM1 = geometry->node[iPoint]->GetVolume_nM1();
13719  Volume_nP1 = geometry->node[iPoint]->GetVolume();
13720 
13721  /*--- Compute the dual time-stepping source residual. Due to the
13722  introduction of the GCL term above, the remainder of the source residual
13723  due to the time discretization has a new form.---*/
13724 
13725  for (iVar = 0; iVar < nVar; iVar++) {
13726  if (config->GetUnsteady_Simulation() == DT_STEPPING_1ST)
13727  Residual[iVar] = (U_time_nP1[iVar] - U_time_n[iVar])*(Volume_nP1/TimeStep);
13728  if (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)
13729  Residual[iVar] = (U_time_nP1[iVar] - U_time_n[iVar])*(3.0*Volume_nP1/(2.0*TimeStep))
13730  + (U_time_nM1[iVar] - U_time_n[iVar])*(Volume_nM1/(2.0*TimeStep));
13731  }
13732  /*--- Store the residual and compute the Jacobian contribution due
13733  to the dual time source term. ---*/
13734 
13735  LinSysRes.AddBlock(iPoint, Residual);
13736  if (implicit) {
13737  for (iVar = 0; iVar < nVar; iVar++) {
13738  for (jVar = 0; jVar < nVar; jVar++) Jacobian_i[iVar][jVar] = 0.0;
13739  if (config->GetUnsteady_Simulation() == DT_STEPPING_1ST)
13740  Jacobian_i[iVar][iVar] = Volume_nP1/TimeStep;
13741  if (config->GetUnsteady_Simulation() == DT_STEPPING_2ND)
13742  Jacobian_i[iVar][iVar] = (3.0*Volume_nP1)/(2.0*TimeStep);
13743  }
13744  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
13745  }
13746  }
13747  }
13748 
13749 }
13750 
13752 
13753  unsigned short iVar;
13754  unsigned long iPoint;
13755  su2double residual;
13756 
13757  /*--- Set Residuals to zero ---*/
13758 
13759  for (iVar = 0; iVar < nVar; iVar++){
13760  SetRes_BGS(iVar,0.0);
13761  SetRes_Max_BGS(iVar,0.0,0);
13762  }
13763 
13764  /*--- Set the residuals ---*/
13765  for (iPoint = 0; iPoint < nPointDomain; iPoint++){
13766  for (iVar = 0; iVar < nVar; iVar++){
13767  residual = node[iPoint]->GetSolution(iVar) - node[iPoint]->Get_BGSSolution_k(iVar);
13768  AddRes_BGS(iVar,residual*residual);
13769  AddRes_Max_BGS(iVar,fabs(residual),geometry->node[iPoint]->GetGlobalIndex(),geometry->node[iPoint]->GetCoord());
13770  }
13771  }
13772 
13773  SetResidual_BGS(geometry, config);
13774 
13775 }
13776 
13777 
13779 
13780  unsigned long iPoint;
13781 
13782  /*--- To nPoint: The solution must be communicated beforehand ---*/
13783  for (iPoint = 0; iPoint < nPoint; iPoint++){
13784 
13785  node[iPoint]->Set_BGSSolution_k();
13786 
13787  }
13788 
13789 }
13790 
13791 void CEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo) {
13792 
13793  /*--- Restart the solution from file information ---*/
13794  unsigned short iDim, iVar, iMesh, iMeshFine;
13795  unsigned long iPoint, index, iChildren, Point_Fine;
13796  unsigned short turb_model = config->GetKind_Turb_Model();
13797  su2double Area_Children, Area_Parent, *Coord, *Solution_Fine;
13798  bool grid_movement = config->GetGrid_Movement();
13799  bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) ||
13800  (config->GetUnsteady_Simulation() == DT_STEPPING_2ND));
13801  bool static_fsi = ((config->GetUnsteady_Simulation() == STEADY) &&
13802  (config->GetFSI_Simulation()));
13803  bool steady_restart = config->GetSteadyRestart();
13804  bool time_stepping = config->GetUnsteady_Simulation() == TIME_STEPPING;
13805 
13806  string UnstExt, text_line;
13807  ifstream restart_file;
13808 
13809  unsigned short iZone = config->GetiZone();
13810  unsigned short nZone = config->GetnZone();
13811 
13812  string restart_filename = config->GetSolution_FlowFileName();
13813 
13814  Coord = new su2double [nDim];
13815  for (iDim = 0; iDim < nDim; iDim++)
13816  Coord[iDim] = 0.0;
13817 
13818  int counter = 0;
13819  long iPoint_Local = 0; unsigned long iPoint_Global = 0;
13820  unsigned long iPoint_Global_Local = 0;
13821  unsigned short rbuf_NotMatching = 0, sbuf_NotMatching = 0;
13822 
13823  /*--- Skip coordinates ---*/
13824 
13825  unsigned short skipVars = geometry[MESH_0]->GetnDim();
13826 
13827  /*--- Multizone problems require the number of the zone to be appended. ---*/
13828 
13829  if (nZone > 1)
13830  restart_filename = config->GetMultizone_FileName(restart_filename, iZone);
13831 
13832  /*--- Modify file name for an unsteady restart ---*/
13833 
13834  if (dual_time || time_stepping)
13835  restart_filename = config->GetUnsteady_FileName(restart_filename, val_iter);
13836 
13837  /*--- Read the restart data from either an ASCII or binary SU2 file. ---*/
13838 
13839  if (config->GetRead_Binary_Restart()) {
13840  Read_SU2_Restart_Binary(geometry[MESH_0], config, restart_filename);
13841  } else {
13842  Read_SU2_Restart_ASCII(geometry[MESH_0], config, restart_filename);
13843  }
13844 
13845  /*--- Load data from the restart into correct containers. ---*/
13846 
13847  counter = 0;
13848  for (iPoint_Global = 0; iPoint_Global < geometry[MESH_0]->GetGlobal_nPointDomain(); iPoint_Global++ ) {
13849 
13850  /*--- Retrieve local index. If this node from the restart file lives
13851  on the current processor, we will load and instantiate the vars. ---*/
13852 
13853  iPoint_Local = geometry[MESH_0]->GetGlobal_to_Local_Point(iPoint_Global);
13854 
13855  if (iPoint_Local > -1) {
13856 
13857  /*--- We need to store this point's data, so jump to the correct
13858  offset in the buffer of data from the restart file and load it. ---*/
13859 
13860  index = counter*Restart_Vars[1] + skipVars;
13861  for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = Restart_Data[index+iVar];
13862  node[iPoint_Local]->SetSolution(Solution);
13863  iPoint_Global_Local++;
13864 
13865  /*--- For dynamic meshes, read in and store the
13866  grid coordinates and grid velocities for each node. ---*/
13867 
13868  if (grid_movement && val_update_geo) {
13869 
13870  /*--- First, remove any variables for the turbulence model that
13871  appear in the restart file before the grid velocities. ---*/
13872 
13873  if (turb_model == SA || turb_model == SA_NEG) {
13874  index++;
13875  } else if (turb_model == SST) {
13876  index+=2;
13877  }
13878 
13879  /*--- Read in the next 2 or 3 variables which are the grid velocities ---*/
13880  /*--- If we are restarting the solution from a previously computed static calculation (no grid movement) ---*/
13881  /*--- the grid velocities are set to 0. This is useful for FSI computations ---*/
13882 
13883  su2double GridVel[3] = {0.0,0.0,0.0};
13884  if (!steady_restart) {
13885 
13886  /*--- Rewind the index to retrieve the Coords. ---*/
13887  index = counter*Restart_Vars[1];
13888  for (iDim = 0; iDim < nDim; iDim++) { Coord[iDim] = Restart_Data[index+iDim]; }
13889 
13890  /*--- Move the index forward to get the grid velocities. ---*/
13891  index = counter*Restart_Vars[1] + skipVars + nVar;
13892  for (iDim = 0; iDim < nDim; iDim++) { GridVel[iDim] = Restart_Data[index+iDim]; }
13893  }
13894 
13895  for (iDim = 0; iDim < nDim; iDim++) {
13896  geometry[MESH_0]->node[iPoint_Local]->SetCoord(iDim, Coord[iDim]);
13897  geometry[MESH_0]->node[iPoint_Local]->SetGridVel(iDim, GridVel[iDim]);
13898  }
13899  }
13900 
13901  if (static_fsi && val_update_geo) {
13902  /*--- Rewind the index to retrieve the Coords. ---*/
13903  index = counter*Restart_Vars[1];
13904  for (iDim = 0; iDim < nDim; iDim++) { Coord[iDim] = Restart_Data[index+iDim];}
13905 
13906  for (iDim = 0; iDim < nDim; iDim++) {
13907  geometry[MESH_0]->node[iPoint_Local]->SetCoord(iDim, Coord[iDim]);
13908  }
13909  }
13910 
13911  /*--- Increment the overall counter for how many points have been loaded. ---*/
13912  counter++;
13913  }
13914 
13915  }
13916 
13917  /*--- Detect a wrong solution file ---*/
13918 
13919  if (iPoint_Global_Local < nPointDomain) { sbuf_NotMatching = 1; }
13920 
13921 #ifndef HAVE_MPI
13922  rbuf_NotMatching = sbuf_NotMatching;
13923 #else
13924  SU2_MPI::Allreduce(&sbuf_NotMatching, &rbuf_NotMatching, 1, MPI_UNSIGNED_SHORT, MPI_SUM, MPI_COMM_WORLD);
13925 #endif
13926  if (rbuf_NotMatching != 0) {
13927  SU2_MPI::Error(string("The solution file ") + restart_filename + string(" doesn't match with the mesh file!\n") +
13928  string("It could be empty lines at the end of the file."), CURRENT_FUNCTION);
13929  }
13930 
13931  /*--- Communicate the loaded solution on the fine grid before we transfer
13932  it down to the coarse levels. We alo call the preprocessing routine
13933  on the fine level in order to have all necessary quantities updated,
13934  especially if this is a turbulent simulation (eddy viscosity). ---*/
13935 
13936  solver[MESH_0][FLOW_SOL]->Set_MPI_Solution(geometry[MESH_0], config);
13937  solver[MESH_0][FLOW_SOL]->Set_MPI_Solution(geometry[MESH_0], config);
13938  solver[MESH_0][FLOW_SOL]->Preprocessing(geometry[MESH_0], solver[MESH_0], config, MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS, false);
13939 
13940  /*--- Interpolate the solution down to the coarse multigrid levels ---*/
13941 
13942  for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
13943  for (iPoint = 0; iPoint < geometry[iMesh]->GetnPoint(); iPoint++) {
13944  Area_Parent = geometry[iMesh]->node[iPoint]->GetVolume();
13945  for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
13946  for (iChildren = 0; iChildren < geometry[iMesh]->node[iPoint]->GetnChildren_CV(); iChildren++) {
13947  Point_Fine = geometry[iMesh]->node[iPoint]->GetChildren_CV(iChildren);
13948  Area_Children = geometry[iMesh-1]->node[Point_Fine]->GetVolume();
13949  Solution_Fine = solver[iMesh-1][FLOW_SOL]->node[Point_Fine]->GetSolution();
13950  for (iVar = 0; iVar < nVar; iVar++) {
13951  Solution[iVar] += Solution_Fine[iVar]*Area_Children/Area_Parent;
13952  }
13953  }
13954  solver[iMesh][FLOW_SOL]->node[iPoint]->SetSolution(Solution);
13955  }
13956  solver[iMesh][FLOW_SOL]->Set_MPI_Solution(geometry[iMesh], config);
13957  solver[iMesh][FLOW_SOL]->Set_MPI_Solution(geometry[iMesh], config);
13958  solver[iMesh][FLOW_SOL]->Preprocessing(geometry[iMesh], solver[iMesh], config, iMesh, NO_RK_ITER, RUNTIME_FLOW_SYS, false);
13959  }
13960 
13961  /*--- Update the geometry for flows on dynamic meshes ---*/
13962 
13963  if (grid_movement && val_update_geo) {
13964 
13965  /*--- Communicate the new coordinates and grid velocities at the halos ---*/
13966 
13967  geometry[MESH_0]->Set_MPI_Coord(config);
13968  geometry[MESH_0]->Set_MPI_GridVel(config);
13969 
13970  /*--- Recompute the edges and dual mesh control volumes in the
13971  domain and on the boundaries. ---*/
13972 
13973  geometry[MESH_0]->SetCoord_CG();
13974  geometry[MESH_0]->SetControlVolume(config, UPDATE);
13975  geometry[MESH_0]->SetBoundControlVolume(config, UPDATE);
13976  geometry[MESH_0]->SetMaxLength(config);
13977 
13978  /*--- Update the multigrid structure after setting up the finest grid,
13979  including computing the grid velocities on the coarser levels. ---*/
13980 
13981  for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
13982  iMeshFine = iMesh-1;
13983  geometry[iMesh]->SetControlVolume(config, geometry[iMeshFine], UPDATE);
13984  geometry[iMesh]->SetBoundControlVolume(config, geometry[iMeshFine],UPDATE);
13985  geometry[iMesh]->SetCoord(geometry[iMeshFine]);
13986  geometry[iMesh]->SetRestricted_GridVelocity(geometry[iMeshFine], config);
13987  geometry[iMesh]->SetMaxLength(config);
13988  }
13989  }
13990 
13991  /*--- Update the geometry for flows on static FSI problems with moving meshes ---*/
13992 
13993  if (static_fsi && val_update_geo) {
13994 
13995  /*--- Communicate the new coordinates and grid velocities at the halos ---*/
13996 
13997  geometry[MESH_0]->Set_MPI_Coord(config);
13998 
13999  /*--- Recompute the edges and dual mesh control volumes in the
14000  domain and on the boundaries. ---*/
14001 
14002  geometry[MESH_0]->SetCoord_CG();
14003  geometry[MESH_0]->SetControlVolume(config, UPDATE);
14004  geometry[MESH_0]->SetBoundControlVolume(config, UPDATE);
14005  geometry[MESH_0]->SetMaxLength(config);
14006 
14007  /*--- Update the multigrid structure after setting up the finest grid,
14008  including computing the grid velocities on the coarser levels. ---*/
14009 
14010  for (iMesh = 1; iMesh <= config->GetnMGLevels(); iMesh++) {
14011  iMeshFine = iMesh-1;
14012  geometry[iMesh]->SetControlVolume(config, geometry[iMeshFine], UPDATE);
14013  geometry[iMesh]->SetBoundControlVolume(config, geometry[iMeshFine],UPDATE);
14014  geometry[iMesh]->SetCoord(geometry[iMeshFine]);
14015  geometry[iMesh]->SetMaxLength(config);
14016  }
14017  }
14018 
14019  delete [] Coord;
14020 
14021  /*--- Delete the class memory that is used to load the restart. ---*/
14022 
14023  if (Restart_Vars != NULL) delete [] Restart_Vars;
14024  if (Restart_Data != NULL) delete [] Restart_Data;
14025  Restart_Vars = NULL; Restart_Data = NULL;
14026 
14027 }
14028 
14030 
14031  unsigned long iPoint;
14032  unsigned short iDim;
14033 
14034  for (iPoint = 0; iPoint < nPoint; iPoint++) {
14035  node[iPoint]->SetSolution(0, Density_Inf);
14036  for (iDim = 0; iDim < nDim; iDim++) {
14037  node[iPoint]->SetSolution(iDim+1, Density_Inf*Velocity_Inf[iDim]);
14038  }
14040  }
14041 }
14042 
14044 
14045  unsigned long iPoint;
14046  unsigned short iDim;
14047  unsigned short iZone = config->GetiZone();
14048  su2double *turboVelocity, *cartVelocity, *turboNormal;
14049 
14050  su2double Alpha = config->GetAoA()*PI_NUMBER/180.0;
14051  su2double Mach = config->GetMach();
14052  su2double SoundSpeed;
14053 
14054  turboVelocity = new su2double[nDim];
14055  cartVelocity = new su2double[nDim];
14056 
14057  turboNormal = config->GetFreeStreamTurboNormal();
14058 
14060  SoundSpeed = FluidModel->GetSoundSpeed();
14061 
14062  /*--- Compute the Free Stream velocity, using the Mach number ---*/
14063  turboVelocity[0] = cos(Alpha)*Mach*SoundSpeed;
14064  turboVelocity[1] = sin(Alpha)*Mach*SoundSpeed;
14065 
14066 
14067  if (nDim == 3) {
14068  turboVelocity[2] = 0.0;
14069  }
14070 
14071  ComputeBackVelocity(turboVelocity, turboNormal, cartVelocity, INFLOW, config->GetKind_TurboMachinery(iZone));
14072 
14073  for (iPoint = 0; iPoint < nPoint; iPoint++) {
14074  node[iPoint]->SetSolution(0, Density_Inf);
14075  for (iDim = 0; iDim < nDim; iDim++) {
14076  node[iPoint]->SetSolution(iDim+1, Density_Inf*cartVelocity[iDim]);
14077  }
14079 
14080  node[iPoint]->SetPrimVar(FluidModel);
14081  node[iPoint]->SetSecondaryVar(FluidModel);
14082  }
14083 
14084  delete [] turboVelocity;
14085  delete [] cartVelocity;
14086 
14087 
14088 }
14089 
14090 
14091 
14092 void CEulerSolver::PreprocessAverage(CSolver **solver, CGeometry *geometry, CConfig *config, unsigned short marker_flag) {
14093 
14094  unsigned long iVertex, iPoint;
14095  unsigned short iDim, iMarker, iMarkerTP, iSpan;
14096  su2double Pressure = 0.0, Density = 0.0, *Velocity = NULL, *TurboVelocity,
14097  Area, TotalArea, TotalAreaPressure, TotalAreaDensity, *TotalAreaVelocity, *UnitNormal, *TurboNormal;
14098  string Marker_Tag, Monitoring_Tag;
14099  unsigned short iZone = config->GetiZone();
14100  su2double *AverageTurboNormal, VelSq;
14101 
14102  /*-- Variables declaration and allocation ---*/
14103  Velocity = new su2double[nDim];
14104  UnitNormal = new su2double[nDim];
14105  TurboNormal = new su2double[nDim];
14106  TurboVelocity = new su2double[nDim];
14107  TotalAreaVelocity = new su2double[nDim];
14108 
14109 #ifdef HAVE_MPI
14110  su2double MyTotalAreaDensity, MyTotalAreaPressure;
14111  su2double *MyTotalAreaVelocity = NULL;
14112 #endif
14113 
14114  for (iSpan= 0; iSpan < nSpanWiseSections; iSpan++){
14115 
14116 
14117  for (iDim=0; iDim<nDim; iDim++) {
14118  TotalAreaVelocity[iDim] = 0.0;
14119  }
14120 
14121  TotalAreaPressure = 0.0;
14122  TotalAreaDensity = 0.0;
14123 
14124  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++){
14125  for (iMarkerTP=1; iMarkerTP < config->GetnMarker_Turbomachinery()+1; iMarkerTP++){
14126  if (config->GetMarker_All_Turbomachinery(iMarker) == iMarkerTP){
14127  if (config->GetMarker_All_TurbomachineryFlag(iMarker) == marker_flag){
14128 
14129  /*--- Retrieve Old Solution ---*/
14130 
14131  /*--- Loop over the vertices to sum all the quantities pithc-wise ---*/
14132  for (iVertex = 0; iVertex < geometry->GetnVertexSpan(iMarker,iSpan); iVertex++) {
14133  iPoint = geometry->turbovertex[iMarker][iSpan][iVertex]->GetNode();
14134  if (geometry->node[iPoint]->GetDomain()){
14135  /*--- Compute the integral fluxes for the boundaries ---*/
14136 
14137  Pressure = node[iPoint]->GetPressure();
14138  Density = node[iPoint]->GetDensity();
14139 
14140  /*--- Normal vector for this vertex (negate for outward convention) ---*/
14141  geometry->turbovertex[iMarker][iSpan][iVertex]->GetNormal(UnitNormal);
14142  geometry->turbovertex[iMarker][iSpan][iVertex]->GetTurboNormal(TurboNormal);
14143  Area = geometry->turbovertex[iMarker][iSpan][iVertex]->GetArea();
14144 
14145  VelSq = 0.0;
14146  for (iDim = 0; iDim < nDim; iDim++) {
14147  Velocity[iDim] = node[iPoint]->GetPrimitive(iDim+1);
14148  VelSq += Velocity[iDim]*Velocity[iDim];
14149  }
14150 
14151  ComputeTurboVelocity(Velocity, TurboNormal , TurboVelocity, marker_flag, config->GetKind_TurboMachinery(iZone));
14152 
14153  /*--- Compute different integral quantities for the boundary of interest ---*/
14154 
14155  TotalAreaPressure += Area*Pressure;
14156  TotalAreaDensity += Area*Density;
14157  for (iDim = 0; iDim < nDim; iDim++)
14158  TotalAreaVelocity[iDim] += Area*Velocity[iDim];
14159  }
14160  }
14161  }
14162  }
14163  }
14164  }
14165 
14166 
14167 #ifdef HAVE_MPI
14168 
14169  /*--- Add information using all the nodes ---*/
14170 
14171  MyTotalAreaDensity = TotalAreaDensity; TotalAreaDensity = 0;
14172  MyTotalAreaPressure = TotalAreaPressure; TotalAreaPressure = 0;
14173 
14174  SU2_MPI::Allreduce(&MyTotalAreaDensity, &TotalAreaDensity, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14175  SU2_MPI::Allreduce(&MyTotalAreaPressure, &TotalAreaPressure, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14176 
14177 
14178  MyTotalAreaVelocity = new su2double[nDim];
14179 
14180 
14181  for (iDim = 0; iDim < nDim; iDim++) {
14182  MyTotalAreaVelocity[iDim] = TotalAreaVelocity[iDim];
14183  TotalAreaVelocity[iDim] = 0.0;
14184  }
14185 
14186  SU2_MPI::Allreduce(MyTotalAreaVelocity, TotalAreaVelocity, nDim, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14187 
14188  delete [] MyTotalAreaVelocity;
14189 
14190 
14191 #endif
14192 
14193  /*--- initialize spanwise average quantities ---*/
14194 
14195 
14196  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++){
14197  for (iMarkerTP=1; iMarkerTP < config->GetnMarker_Turbomachinery()+1; iMarkerTP++){
14198  if (config->GetMarker_All_Turbomachinery(iMarker) == iMarkerTP){
14199  if (config->GetMarker_All_TurbomachineryFlag(iMarker) == marker_flag){
14200 
14201  TotalArea = geometry->GetSpanArea(iMarker,iSpan);
14202  AverageTurboNormal = geometry->GetAverageTurboNormal(iMarker,iSpan);
14203 
14204  /*--- Compute the averaged value for the boundary of interest for the span of interest ---*/
14205 
14206  AverageDensity[iMarker][iSpan] = TotalAreaDensity / TotalArea;
14207  AveragePressure[iMarker][iSpan] = TotalAreaPressure / TotalArea;
14208  for (iDim = 0; iDim < nDim; iDim++)
14209  AverageVelocity[iMarker][iSpan][iDim] = TotalAreaVelocity[iDim] / TotalArea;
14210 
14211  /* --- compute static averaged quantities ---*/
14212  ComputeTurboVelocity(AverageVelocity[iMarker][iSpan], AverageTurboNormal , AverageTurboVelocity[iMarker][iSpan], marker_flag, config->GetKind_TurboMachinery(iZone));
14213 
14214  OldAverageDensity[iMarker][iSpan] = AverageDensity[iMarker][iSpan];
14215  OldAveragePressure[iMarker][iSpan] = AveragePressure[iMarker][iSpan];
14216  for(iDim = 0; iDim < nDim;iDim++)
14217  OldAverageTurboVelocity[iMarker][iSpan][iDim] = AverageTurboVelocity[iMarker][iSpan][iDim];
14218 
14219  }
14220  }
14221  }
14222  }
14223  }
14224 
14225  /*--- initialize 1D average quantities ---*/
14226 
14227  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++){
14228  for (iMarkerTP=1; iMarkerTP < config->GetnMarker_Turbomachinery()+1; iMarkerTP++){
14229  if (config->GetMarker_All_Turbomachinery(iMarker) == iMarkerTP){
14230  if (config->GetMarker_All_TurbomachineryFlag(iMarker) == marker_flag){
14231 
14232  AverageTurboNormal = geometry->GetAverageTurboNormal(iMarker,nSpanWiseSections);
14233 
14234  /*--- Compute the averaged value for the boundary of interest for the span of interest ---*/
14235 
14238  for (iDim = 0; iDim < nDim; iDim++)
14239  AverageVelocity[iMarker][nSpanWiseSections][iDim] = AverageVelocity[iMarker][nSpanWiseSections/2][iDim];
14240 
14241  /* --- compute static averaged quantities ---*/
14242  ComputeTurboVelocity(AverageVelocity[iMarker][nSpanWiseSections], AverageTurboNormal , AverageTurboVelocity[iMarker][nSpanWiseSections], marker_flag, config->GetKind_TurboMachinery(iZone));
14243 
14246  for(iDim = 0; iDim < nDim;iDim++)
14248 
14249  }
14250  }
14251  }
14252  }
14253 
14254 
14255  /*--- Free locally allocated memory ---*/
14256  delete [] Velocity;
14257  delete [] UnitNormal;
14258  delete [] TurboNormal;
14259  delete [] TurboVelocity;
14260  delete [] TotalAreaVelocity;
14261 
14262 }
14263 
14264 
14265 void CEulerSolver::TurboAverageProcess(CSolver **solver, CGeometry *geometry, CConfig *config, unsigned short marker_flag) {
14266 
14267  unsigned long iVertex, iPoint, nVert;
14268  unsigned short iDim, iVar, iMarker, iMarkerTP, iSpan, jSpan;
14269  unsigned short average_process = config->GetKind_AverageProcess();
14270  unsigned short performance_average_process = config->GetKind_PerformanceAverageProcess();
14271  su2double Pressure = 0.0, Density = 0.0, Enthalpy = 0.0, *Velocity = NULL, *TurboVelocity,
14272  Area, TotalArea, Radius1, Radius2, Vt2, TotalAreaPressure, TotalAreaDensity, *TotalAreaVelocity, *UnitNormal, *TurboNormal,
14273  TotalMassPressure, TotalMassDensity, *TotalMassVelocity;
14274  string Marker_Tag, Monitoring_Tag;
14275  su2double val_init_pressure;
14276  unsigned short iZone = config->GetiZone();
14277  su2double TotalDensity, TotalPressure, *TotalVelocity, *AverageTurboNormal, *TotalFluxes;
14278  su2double TotalNu, TotalOmega, TotalKine, TotalMassNu, TotalMassOmega, TotalMassKine, TotalAreaNu, TotalAreaOmega, TotalAreaKine;
14279  su2double Nu, Kine, Omega;
14280  su2double MachTest, soundSpeed;
14281  bool turbulent = ((config->GetKind_Solver() == RANS) || (config->GetKind_Solver() == DISC_ADJ_RANS));
14282  bool spalart_allmaras = (config->GetKind_Turb_Model() == SA);
14283  bool menter_sst = (config->GetKind_Turb_Model() == SST);
14284 
14285  /*-- Variables declaration and allocation ---*/
14286  Velocity = new su2double[nDim];
14287  UnitNormal = new su2double[nDim];
14288  TurboNormal = new su2double[nDim];
14289  TurboVelocity = new su2double[nDim];
14290  TotalVelocity = new su2double[nDim];
14291  TotalAreaVelocity = new su2double[nDim];
14292  TotalMassVelocity = new su2double[nDim];
14293  TotalFluxes = new su2double[nVar];
14294 
14295  su2double avgDensity, *avgVelocity, avgPressure, avgKine, avgOmega, avgNu, avgAreaDensity, *avgAreaVelocity, avgAreaPressure,
14296  avgAreaKine, avgAreaOmega, avgAreaNu, avgMassDensity, *avgMassVelocity, avgMassPressure, avgMassKine, avgMassOmega, avgMassNu,
14297  avgMixDensity, *avgMixVelocity, *avgMixTurboVelocity, avgMixPressure, avgMixKine, avgMixOmega, avgMixNu;
14298 
14299  avgVelocity = new su2double[nDim];
14300  avgAreaVelocity = new su2double[nDim];
14301  avgMassVelocity = new su2double[nDim];
14302  avgMixVelocity = new su2double[nDim];
14303  avgMixTurboVelocity = new su2double[nDim];
14304 
14305 
14306 #ifdef HAVE_MPI
14307  su2double MyTotalDensity, MyTotalPressure, MyTotalAreaDensity, MyTotalAreaPressure, MyTotalMassPressure, MyTotalMassDensity, *MyTotalFluxes = NULL;
14308  su2double *MyTotalVelocity = NULL, *MyTotalAreaVelocity = NULL, *MyTotalMassVelocity = NULL;
14309  su2double MyTotalNu, MyTotalKine, MyTotalOmega, MyTotalAreaNu, MyTotalAreaKine, MyTotalAreaOmega, MyTotalMassNu, MyTotalMassKine, MyTotalMassOmega;
14310 #endif
14311 
14312 
14313  for (iSpan= 0; iSpan < nSpanWiseSections + 1; iSpan++){
14314 
14315  /*--- Forces initialization for contenitors ---*/
14316  for (iVar=0;iVar<nVar;iVar++)
14317  TotalFluxes[iVar]= 0.0;
14318  for (iDim=0; iDim<nDim; iDim++) {
14319  TotalVelocity[iDim] = 0.0;
14320  TotalAreaVelocity[iDim] = 0.0;
14321  TotalMassVelocity[iDim] = 0.0;
14322  }
14323 
14324  TotalDensity = 0.0;
14325  TotalPressure = 0.0;
14326  TotalAreaPressure = 0.0;
14327  TotalAreaDensity = 0.0;
14328  TotalMassPressure = 0.0;
14329  TotalMassDensity = 0.0;
14330  TotalNu = 0.0;
14331  TotalOmega = 0.0;
14332  TotalKine = 0.0;
14333  TotalMassNu = 0.0;
14334  TotalMassOmega = 0.0;
14335  TotalMassKine = 0.0;
14336  TotalAreaNu = 0.0;
14337  TotalAreaOmega = 0.0;
14338  TotalAreaKine = 0.0;
14339 
14340  Nu = 0.0;
14341  Omega = 0.0;
14342  Kine = 0.0;
14343 
14344 
14345  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++){
14346  for (iMarkerTP=1; iMarkerTP < config->GetnMarker_Turbomachinery()+1; iMarkerTP++){
14347  if (config->GetMarker_All_Turbomachinery(iMarker) == iMarkerTP){
14348  if (config->GetMarker_All_TurbomachineryFlag(iMarker) == marker_flag){
14349 
14350  /*--- Retrieve Old Solution ---*/
14351 
14352  /*--- Loop over the vertices to sum all the quantities pithc-wise ---*/
14353  if(iSpan < nSpanWiseSections){
14354  for (iVertex = 0; iVertex < geometry->GetnVertexSpan(iMarker,iSpan); iVertex++) {
14355  iPoint = geometry->turbovertex[iMarker][iSpan][iVertex]->GetNode();
14356 
14357  /*--- Compute the integral fluxes for the boundaries ---*/
14358  Pressure = node[iPoint]->GetPressure();
14359  Density = node[iPoint]->GetDensity();
14360  Enthalpy = node[iPoint]->GetEnthalpy();
14361 
14362  /*--- Normal vector for this vertex (negate for outward convention) ---*/
14363  geometry->turbovertex[iMarker][iSpan][iVertex]->GetNormal(UnitNormal);
14364  geometry->turbovertex[iMarker][iSpan][iVertex]->GetTurboNormal(TurboNormal);
14365  Area = geometry->turbovertex[iMarker][iSpan][iVertex]->GetArea();
14366  su2double VelNormal = 0.0, VelSq = 0.0;
14367 
14368  for (iDim = 0; iDim < nDim; iDim++) {
14369  Velocity[iDim] = node[iPoint]->GetPrimitive(iDim+1);
14370  VelNormal += UnitNormal[iDim]*Velocity[iDim];
14371  VelSq += Velocity[iDim]*Velocity[iDim];
14372  }
14373 
14374  ComputeTurboVelocity(Velocity, TurboNormal , TurboVelocity, marker_flag, config->GetKind_TurboMachinery(iZone));
14375 
14376  /*--- Compute different integral quantities for the boundary of interest ---*/
14377 
14378  TotalDensity += Density;
14379  TotalPressure += Pressure;
14380  for (iDim = 0; iDim < nDim; iDim++)
14381  TotalVelocity[iDim] += Velocity[iDim];
14382 
14383  TotalAreaPressure += Area*Pressure;
14384  TotalAreaDensity += Area*Density;
14385  for (iDim = 0; iDim < nDim; iDim++)
14386  TotalAreaVelocity[iDim] += Area*Velocity[iDim];
14387 
14388  TotalMassPressure += Area*(Density*TurboVelocity[0] )*Pressure;
14389  TotalMassDensity += Area*(Density*TurboVelocity[0] )*Density;
14390  for (iDim = 0; iDim < nDim; iDim++)
14391  TotalMassVelocity[iDim] += Area*(Density*TurboVelocity[0] )*Velocity[iDim];
14392 
14393  TotalFluxes[0] += Area*(Density*TurboVelocity[0]);
14394  TotalFluxes[1] += Area*(Density*TurboVelocity[0]*TurboVelocity[0] + Pressure);
14395  for (iDim = 2; iDim < nDim+1; iDim++)
14396  TotalFluxes[iDim] += Area*(Density*TurboVelocity[0]*TurboVelocity[iDim -1]);
14397  TotalFluxes[nDim+1] += Area*(Density*TurboVelocity[0]*Enthalpy);
14398 
14399 
14400  /*--- Compute turbulent integral quantities for the boundary of interest ---*/
14401 
14402  if(turbulent){
14403  if(menter_sst){
14404  Kine = solver[TURB_SOL]->node[iPoint]->GetSolution(0);
14405  Omega = solver[TURB_SOL]->node[iPoint]->GetSolution(1);
14406  }
14407  if(spalart_allmaras){
14408  Nu = solver[TURB_SOL]->node[iPoint]->GetSolution(0);
14409  }
14410 
14411  TotalKine += Kine;
14412  TotalOmega += Omega;
14413  TotalNu += Nu;
14414 
14415  TotalAreaKine += Area*Kine;
14416  TotalAreaOmega += Area*Omega;
14417  TotalAreaNu += Area*Nu;
14418 
14419  TotalMassKine += Area*(Density*TurboVelocity[0] )*Kine;
14420  TotalMassOmega += Area*(Density*TurboVelocity[0] )*Omega;
14421  TotalMassNu += Area*(Density*TurboVelocity[0] )*Nu;
14422 
14423 
14424  }
14425  }
14426  }
14427  else{
14428  for (jSpan= 0; jSpan < nSpanWiseSections; jSpan++){
14429  for (iVertex = 0; iVertex < geometry->GetnVertexSpan(iMarker,jSpan); iVertex++) {
14430  iPoint = geometry->turbovertex[iMarker][jSpan][iVertex]->GetNode();
14431 
14432  /*--- Compute the integral fluxes for the boundaries ---*/
14433  Pressure = node[iPoint]->GetPressure();
14434  Density = node[iPoint]->GetDensity();
14435  Enthalpy = node[iPoint]->GetEnthalpy();
14436 
14437  /*--- Normal vector for this vertex (negate for outward convention) ---*/
14438  geometry->turbovertex[iMarker][jSpan][iVertex]->GetNormal(UnitNormal);
14439  geometry->turbovertex[iMarker][jSpan][iVertex]->GetTurboNormal(TurboNormal);
14440  Area = geometry->turbovertex[iMarker][jSpan][iVertex]->GetArea();
14441  su2double VelNormal = 0.0, VelSq = 0.0;
14442 
14443  for (iDim = 0; iDim < nDim; iDim++) {
14444  Velocity[iDim] = node[iPoint]->GetPrimitive(iDim+1);
14445  VelNormal += UnitNormal[iDim]*Velocity[iDim];
14446  VelSq += Velocity[iDim]*Velocity[iDim];
14447  }
14448 
14449  ComputeTurboVelocity(Velocity, TurboNormal , TurboVelocity, marker_flag, config->GetKind_TurboMachinery(iZone));
14450 
14451  /*--- Compute different integral quantities for the boundary of interest ---*/
14452 
14453  TotalDensity += Density;
14454  TotalPressure += Pressure;
14455  for (iDim = 0; iDim < nDim; iDim++)
14456  TotalVelocity[iDim] += Velocity[iDim];
14457 
14458  TotalAreaPressure += Area*Pressure;
14459  TotalAreaDensity += Area*Density;
14460  for (iDim = 0; iDim < nDim; iDim++)
14461  TotalAreaVelocity[iDim] += Area*Velocity[iDim];
14462 
14463  TotalMassPressure += Area*(Density*TurboVelocity[0] )*Pressure;
14464  TotalMassDensity += Area*(Density*TurboVelocity[0] )*Density;
14465  for (iDim = 0; iDim < nDim; iDim++)
14466  TotalMassVelocity[iDim] += Area*(Density*TurboVelocity[0] )*Velocity[iDim];
14467 
14468  TotalFluxes[0] += Area*(Density*TurboVelocity[0]);
14469  TotalFluxes[1] += Area*(Density*TurboVelocity[0]*TurboVelocity[0] + Pressure);
14470  for (iDim = 2; iDim < nDim+1; iDim++)
14471  TotalFluxes[iDim] += Area*(Density*TurboVelocity[0]*TurboVelocity[iDim -1]);
14472  TotalFluxes[nDim+1] += Area*(Density*TurboVelocity[0]*Enthalpy);
14473 
14474 
14475  /*--- Compute turbulent integral quantities for the boundary of interest ---*/
14476 
14477  if(turbulent){
14478  if(menter_sst){
14479  Kine = solver[TURB_SOL]->node[iPoint]->GetSolution(0);
14480  Omega = solver[TURB_SOL]->node[iPoint]->GetSolution(1);
14481  }
14482  if(spalart_allmaras){
14483  Nu = solver[TURB_SOL]->node[iPoint]->GetSolution(0);
14484  }
14485 
14486  TotalKine += Kine;
14487  TotalOmega += Omega;
14488  TotalNu += Nu;
14489 
14490  TotalAreaKine += Area*Kine;
14491  TotalAreaOmega += Area*Omega;
14492  TotalAreaNu += Area*Nu;
14493 
14494  TotalMassKine += Area*(Density*TurboVelocity[0] )*Kine;
14495  TotalMassOmega += Area*(Density*TurboVelocity[0] )*Omega;
14496  TotalMassNu += Area*(Density*TurboVelocity[0] )*Nu;
14497 
14498  }
14499  }
14500  }
14501  }
14502  }
14503  }
14504  }
14505  }
14506 
14507 #ifdef HAVE_MPI
14508 
14509  /*--- Add information using all the nodes ---*/
14510 
14511  MyTotalDensity = TotalDensity; TotalDensity = 0;
14512  MyTotalPressure = TotalPressure; TotalPressure = 0;
14513  MyTotalAreaDensity = TotalAreaDensity; TotalAreaDensity = 0;
14514  MyTotalAreaPressure = TotalAreaPressure; TotalAreaPressure = 0;
14515  MyTotalMassDensity = TotalMassDensity; TotalMassDensity = 0;
14516  MyTotalMassPressure = TotalMassPressure; TotalMassPressure = 0;
14517  MyTotalNu = TotalNu; TotalNu = 0;
14518  MyTotalKine = TotalKine; TotalKine = 0;
14519  MyTotalOmega = TotalOmega; TotalOmega = 0;
14520  MyTotalAreaNu = TotalAreaNu; TotalAreaNu = 0;
14521  MyTotalAreaKine = TotalAreaKine; TotalAreaKine = 0;
14522  MyTotalAreaOmega = TotalAreaOmega; TotalAreaOmega = 0;
14523  MyTotalMassNu = TotalMassNu; TotalMassNu = 0;
14524  MyTotalMassKine = TotalMassKine; TotalMassKine = 0;
14525  MyTotalMassOmega = TotalMassOmega; TotalMassOmega = 0;
14526 
14527 
14528 
14529 
14530  SU2_MPI::Allreduce(&MyTotalDensity, &TotalDensity, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14531  SU2_MPI::Allreduce(&MyTotalPressure, &TotalPressure, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14532  SU2_MPI::Allreduce(&MyTotalAreaDensity, &TotalAreaDensity, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14533  SU2_MPI::Allreduce(&MyTotalAreaPressure, &TotalAreaPressure, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14534  SU2_MPI::Allreduce(&MyTotalMassDensity, &TotalMassDensity, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14535  SU2_MPI::Allreduce(&MyTotalMassPressure, &TotalMassPressure, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14536  SU2_MPI::Allreduce(&MyTotalNu, &TotalNu, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14537  SU2_MPI::Allreduce(&MyTotalKine, &TotalKine, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14538  SU2_MPI::Allreduce(&MyTotalOmega, &TotalOmega, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14539  SU2_MPI::Allreduce(&MyTotalAreaNu, &TotalAreaNu, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14540  SU2_MPI::Allreduce(&MyTotalAreaKine, &TotalAreaKine, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14541  SU2_MPI::Allreduce(&MyTotalAreaOmega, &TotalAreaOmega, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14542  SU2_MPI::Allreduce(&MyTotalMassNu, &TotalMassNu, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14543  SU2_MPI::Allreduce(&MyTotalMassKine, &TotalMassKine, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14544  SU2_MPI::Allreduce(&MyTotalMassOmega, &TotalMassOmega, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14545 
14546 
14547  MyTotalFluxes = new su2double[nVar];
14548  MyTotalVelocity = new su2double[nDim];
14549  MyTotalAreaVelocity = new su2double[nDim];
14550  MyTotalMassVelocity = new su2double[nDim];
14551 
14552  for (iVar = 0; iVar < nVar; iVar++) {
14553  MyTotalFluxes[iVar] = TotalFluxes[iVar];
14554  TotalFluxes[iVar] = 0.0;
14555  }
14556 
14557  for (iDim = 0; iDim < nDim; iDim++) {
14558  MyTotalVelocity[iDim] = TotalVelocity[iDim];
14559  TotalVelocity[iDim] = 0.0;
14560  MyTotalAreaVelocity[iDim] = TotalAreaVelocity[iDim];
14561  TotalAreaVelocity[iDim] = 0.0;
14562  MyTotalMassVelocity[iDim] = TotalMassVelocity[iDim];
14563  TotalMassVelocity[iDim] = 0.0;
14564  }
14565 
14566  SU2_MPI::Allreduce(MyTotalFluxes, TotalFluxes, nVar, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14567  SU2_MPI::Allreduce(MyTotalVelocity, TotalVelocity, nDim, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14568  SU2_MPI::Allreduce(MyTotalAreaVelocity, TotalAreaVelocity, nDim, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14569  SU2_MPI::Allreduce(MyTotalMassVelocity, TotalMassVelocity, nDim, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
14570 
14571  delete [] MyTotalFluxes; delete [] MyTotalVelocity; delete [] MyTotalAreaVelocity; delete [] MyTotalMassVelocity;
14572 
14573 
14574 #endif
14575 
14576 
14577  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++){
14578  for (iMarkerTP=1; iMarkerTP < config->GetnMarker_Turbomachinery()+1; iMarkerTP++){
14579  if (config->GetMarker_All_Turbomachinery(iMarker) == iMarkerTP){
14580  if (config->GetMarker_All_TurbomachineryFlag(iMarker) == marker_flag){
14581 
14582  TotalArea = geometry->GetSpanArea(iMarker,iSpan);
14583  AverageTurboNormal = geometry->GetAverageTurboNormal(iMarker,iSpan);
14584  nVert = geometry->GetnTotVertexSpan(iMarker,iSpan);
14585 
14586 
14587 
14588  /*--- compute normal Mach number as a check for massflow average and mixedout average ---*/
14589  FluidModel->SetTDState_Prho(TotalAreaPressure/TotalArea, TotalAreaDensity / TotalArea);
14590  soundSpeed = FluidModel->GetSoundSpeed();
14591  MachTest = TotalFluxes[0]/(TotalAreaDensity*soundSpeed);
14592 
14593  /*--- Compute the averaged value for the boundary of interest for the span of interest ---*/
14594 
14595  /*--- compute algebraic average ---*/
14596  avgDensity = TotalDensity / nVert;
14597  avgPressure = TotalPressure / nVert;
14598  for (iDim = 0; iDim < nDim; iDim++) avgVelocity[iDim] = TotalVelocity[iDim] / nVert;
14599  avgKine = TotalKine/nVert;
14600  avgOmega = TotalOmega/nVert;
14601  avgNu = TotalNu/nVert;
14602 
14603  /*--- compute area average ---*/
14604  avgAreaDensity = TotalAreaDensity / TotalArea;
14605  avgAreaPressure = TotalAreaPressure / TotalArea;
14606  for (iDim = 0; iDim < nDim; iDim++) avgAreaVelocity[iDim] = TotalAreaVelocity[iDim] / TotalArea;
14607  avgAreaKine = TotalAreaKine / TotalArea;
14608  avgAreaOmega = TotalAreaOmega / TotalArea;
14609  avgAreaNu = TotalAreaNu / TotalArea;
14610 
14611  /*--- compute mass-flow average ---*/
14612  if (abs(MachTest)< config->GetAverageMachLimit()) {
14613  avgMassDensity = avgAreaDensity;
14614  avgMassPressure = avgAreaPressure;
14615  for (iDim = 0; iDim < nDim; iDim++) avgMassVelocity[iDim] = avgAreaVelocity[iDim];
14616  avgMassKine = avgAreaKine;
14617  avgMassOmega = avgAreaOmega;
14618  avgMassNu = avgAreaNu;
14619  }else{
14620  avgMassDensity = TotalMassDensity / TotalFluxes[0];
14621  avgMassPressure = TotalMassPressure / TotalFluxes[0];
14622  for (iDim = 0; iDim < nDim; iDim++) avgMassVelocity[iDim] = TotalMassVelocity[iDim] / TotalFluxes[0];
14623  avgMassKine = TotalMassKine / TotalFluxes[0];
14624  avgMassOmega = TotalMassOmega / TotalFluxes[0];
14625  avgMassNu = TotalMassNu / TotalFluxes[0];
14626  }
14627  /*--- compute mixed-out average ---*/
14628  for (iVar = 0; iVar<nVar; iVar++){
14629  AverageFlux[iMarker][iSpan][iVar] = TotalFluxes[iVar]/TotalArea;
14630  SpanTotalFlux[iMarker][iSpan][iVar] = TotalFluxes[iVar];
14631  }
14632  val_init_pressure = OldAveragePressure[iMarker][iSpan];
14633 
14634  if (abs(MachTest)< config->GetAverageMachLimit()) {
14635  avgMixDensity = avgAreaDensity;
14636  avgMixPressure = avgAreaPressure;
14637  for (iDim = 0; iDim < nDim; iDim++)
14638  avgMixVelocity[iDim] = avgAreaVelocity[iDim];
14639  ComputeTurboVelocity(avgMixVelocity, AverageTurboNormal , avgMixTurboVelocity, marker_flag, config->GetKind_TurboMachinery(iZone));
14640  avgMixKine = avgAreaKine;
14641  avgMixOmega = avgAreaOmega;
14642  avgMixNu = avgAreaNu;
14643  }else {
14644  MixedOut_Average (config, val_init_pressure, AverageFlux[iMarker][iSpan], AverageTurboNormal, avgMixPressure, avgMixDensity);
14645  avgMixTurboVelocity[0] = ( AverageFlux[iMarker][iSpan][1] - avgMixPressure) / AverageFlux[iMarker][iSpan][0];
14646  for (iDim = 2; iDim < nDim +1;iDim++)
14647  avgMixTurboVelocity[iDim-1] = AverageFlux[iMarker][iSpan][iDim] / AverageFlux[iMarker][iSpan][0];
14648 
14649  if (avgMixDensity!= avgMixDensity || avgMixPressure!= avgMixPressure || avgMixPressure < 0.0 || avgMixDensity < 0.0 ){
14650  val_init_pressure = avgAreaPressure;
14651  MixedOut_Average (config, val_init_pressure, AverageFlux[iMarker][iSpan], AverageTurboNormal, avgMixPressure, avgMixDensity);
14652  avgMixTurboVelocity[0] = ( AverageFlux[iMarker][iSpan][1] - avgMixPressure) / AverageFlux[iMarker][iSpan][0];
14653  for (iDim = 2; iDim < nDim +1;iDim++)
14654  avgMixTurboVelocity[iDim-1] = AverageFlux[iMarker][iSpan][iDim] / AverageFlux[iMarker][iSpan][0];
14655  }
14656  avgMixKine = avgMassKine;
14657  avgMixOmega = avgMassOmega;
14658  avgMixNu = avgMassNu;
14659  }
14660 
14661  /*--- Store averaged value for the selected average method ---*/
14662  switch(average_process){
14663  case ALGEBRAIC:
14664  AverageDensity[iMarker][iSpan] = avgDensity;
14665  AveragePressure[iMarker][iSpan] = avgPressure;
14666  ComputeTurboVelocity(avgVelocity, AverageTurboNormal , AverageTurboVelocity[iMarker][iSpan], marker_flag, config->GetKind_TurboMachinery(iZone));
14667  AverageKine[iMarker][iSpan] = avgKine;
14668  AverageOmega[iMarker][iSpan] = avgOmega;
14669  AverageNu[iMarker][iSpan] = avgNu;
14670  break;
14671 
14672  case AREA:
14673  AverageDensity[iMarker][iSpan] = avgAreaDensity;
14674  AveragePressure[iMarker][iSpan] = avgAreaPressure;
14675  ComputeTurboVelocity(avgAreaVelocity, AverageTurboNormal , AverageTurboVelocity[iMarker][iSpan], marker_flag, config->GetKind_TurboMachinery(iZone));
14676  AverageKine[iMarker][iSpan] = avgAreaKine;
14677  AverageOmega[iMarker][iSpan] = avgAreaOmega;
14678  AverageNu[iMarker][iSpan] = avgAreaNu;
14679  break;
14680 
14681  case MASSFLUX:
14682  AverageDensity[iMarker][iSpan] = avgMassDensity;
14683  AveragePressure[iMarker][iSpan] = avgMassPressure;
14684  ComputeTurboVelocity(avgAreaVelocity, AverageTurboNormal , AverageTurboVelocity[iMarker][iSpan], marker_flag, config->GetKind_TurboMachinery(iZone));
14685  AverageKine[iMarker][iSpan] = avgMassKine;
14686  AverageOmega[iMarker][iSpan] = avgMassOmega;
14687  AverageNu[iMarker][iSpan] = avgMassNu;
14688  break;
14689 
14690  case MIXEDOUT:
14691  AverageDensity[iMarker][iSpan] = avgMixDensity;
14692  AveragePressure[iMarker][iSpan] = avgMixPressure;
14693  for (iDim = 0; iDim < nDim; iDim++) AverageTurboVelocity[iMarker][iSpan][iDim] = avgMixTurboVelocity[iDim];
14694  AverageKine[iMarker][iSpan] = avgMixKine;
14695  AverageOmega[iMarker][iSpan] = avgMixOmega;
14696  AverageNu[iMarker][iSpan] = avgMixNu;
14697  break;
14698 
14699  default:
14700  SU2_MPI::Error(" Invalid AVERAGE PROCESS input!", CURRENT_FUNCTION);
14701  break;
14702  }
14703 
14704  /* --- check if averaged quantities are correct otherwise reset the old quantities ---*/
14705  if (AverageDensity[iMarker][iSpan]!= AverageDensity[iMarker][iSpan] || AveragePressure[iMarker][iSpan]!= AveragePressure[iMarker][iSpan]){
14706  cout<<"nan in mixing process routine for iSpan: " << iSpan<< " in marker " << config->GetMarker_All_TagBound(iMarker)<< endl;
14707  AverageDensity[iMarker][iSpan] = OldAverageDensity[iMarker][iSpan];
14708  AveragePressure[iMarker][iSpan] = OldAveragePressure[iMarker][iSpan];
14709  for(iDim = 0; iDim < nDim;iDim++)
14710  AverageTurboVelocity[iMarker][iSpan][iDim] = OldAverageTurboVelocity[iMarker][iSpan][iDim];
14711  }
14712 
14713 
14714  if (AverageDensity[iMarker][iSpan] < 0.0 || AveragePressure[iMarker][iSpan] < 0.0){
14715  cout << " negative density or pressure in mixing process routine for iSpan: " << iSpan<< " in marker " << config->GetMarker_All_TagBound(iMarker)<< endl;
14716  AverageDensity[iMarker][iSpan] = OldAverageDensity[iMarker][iSpan];
14717  AveragePressure[iMarker][iSpan] = OldAveragePressure[iMarker][iSpan];
14718  for(iDim = 0; iDim < nDim;iDim++)
14719  AverageTurboVelocity[iMarker][iSpan][iDim] = OldAverageTurboVelocity[iMarker][iSpan][iDim];
14720  }
14721 
14722  /* --- update old average solution ---*/
14723  OldAverageDensity[iMarker][iSpan] = AverageDensity[iMarker][iSpan];
14724  OldAveragePressure[iMarker][iSpan] = AveragePressure[iMarker][iSpan];
14725  for(iDim = 0; iDim < nDim;iDim++)
14726  OldAverageTurboVelocity[iMarker][iSpan][iDim] = AverageTurboVelocity[iMarker][iSpan][iDim];
14727 
14728  /*--- to avoid back flow ---*/
14729  if (AverageTurboVelocity[iMarker][iSpan][0] < 0.0){
14730  AverageTurboVelocity[iMarker][iSpan][0] = soundSpeed*config->GetAverageMachLimit();
14731  }
14732 
14733  /*--- compute cartesian average Velocity ---*/
14734  ComputeBackVelocity(AverageTurboVelocity[iMarker][iSpan], AverageTurboNormal , AverageVelocity[iMarker][iSpan], marker_flag, config->GetKind_TurboMachinery(iZone));
14735 
14736 
14737  /*--- Store averaged performance value for the selected average method ---*/
14738  switch(performance_average_process){
14739  case ALGEBRAIC:
14740  if(marker_flag == INFLOW){
14741  DensityIn[iMarkerTP - 1][iSpan] = avgDensity;
14742  PressureIn[iMarkerTP - 1][iSpan] = avgPressure;
14743  ComputeTurboVelocity(avgVelocity, AverageTurboNormal , TurboVelocityIn[iMarkerTP -1][iSpan], marker_flag, config->GetKind_TurboMachinery(iZone));
14744  KineIn[iMarkerTP - 1][iSpan] = avgKine;
14745  OmegaIn[iMarkerTP - 1][iSpan] = avgOmega;
14746  NuIn[iMarkerTP - 1][iSpan] = avgNu;
14747  }
14748  else{
14749  DensityOut[iMarkerTP - 1][iSpan] = avgDensity;
14750  PressureOut[iMarkerTP - 1][iSpan] = avgPressure;
14751  ComputeTurboVelocity(avgVelocity, AverageTurboNormal , TurboVelocityOut[iMarkerTP -1][iSpan], marker_flag, config->GetKind_TurboMachinery(iZone));
14752  KineOut[iMarkerTP - 1][iSpan] = avgKine;
14753  OmegaOut[iMarkerTP - 1][iSpan] = avgOmega;
14754  NuOut[iMarkerTP - 1][iSpan] = avgNu;
14755  }
14756 
14757  break;
14758  case AREA:
14759  if(marker_flag == INFLOW){
14760  DensityIn[iMarkerTP - 1][iSpan] = avgAreaDensity;
14761  PressureIn[iMarkerTP - 1][iSpan] = avgAreaPressure;
14762  ComputeTurboVelocity(avgAreaVelocity, AverageTurboNormal , TurboVelocityIn[iMarkerTP -1][iSpan], marker_flag, config->GetKind_TurboMachinery(iZone));
14763  KineIn[iMarkerTP - 1][iSpan] = avgAreaKine;
14764  OmegaIn[iMarkerTP - 1][iSpan] = avgAreaOmega;
14765  NuIn[iMarkerTP - 1][iSpan] = avgAreaNu;
14766  }
14767  else{
14768  DensityOut[iMarkerTP - 1][iSpan] = avgAreaDensity;
14769  PressureOut[iMarkerTP - 1][iSpan] = avgAreaPressure;
14770  ComputeTurboVelocity(avgAreaVelocity, AverageTurboNormal , TurboVelocityOut[iMarkerTP -1][iSpan], marker_flag, config->GetKind_TurboMachinery(iZone));
14771  KineOut[iMarkerTP - 1][iSpan] = avgAreaKine;
14772  OmegaOut[iMarkerTP - 1][iSpan] = avgAreaOmega;
14773  NuOut[iMarkerTP - 1][iSpan] = avgAreaNu/TotalArea;
14774  }
14775  break;
14776 
14777  case MASSFLUX:
14778  if(marker_flag == INFLOW){
14779  DensityIn[iMarkerTP - 1][iSpan] = avgMassDensity;
14780  PressureIn[iMarkerTP - 1][iSpan] = avgMassPressure;
14781  ComputeTurboVelocity(avgMassVelocity, AverageTurboNormal , TurboVelocityIn[iMarkerTP -1][iSpan], marker_flag, config->GetKind_TurboMachinery(iZone));
14782  KineIn[iMarkerTP - 1][iSpan] = avgMassKine;
14783  OmegaIn[iMarkerTP - 1][iSpan] = avgMassOmega;
14784  NuIn[iMarkerTP - 1][iSpan] = avgMassNu;
14785  }
14786  else{
14787  DensityOut[iMarkerTP - 1][iSpan] = avgMassDensity;
14788  PressureOut[iMarkerTP - 1][iSpan] = avgMassPressure;
14789  ComputeTurboVelocity(avgMassVelocity, AverageTurboNormal , TurboVelocityOut[iMarkerTP -1][iSpan], marker_flag, config->GetKind_TurboMachinery(iZone));
14790  KineOut[iMarkerTP - 1][iSpan] = avgMassKine;
14791  OmegaOut[iMarkerTP - 1][iSpan] = avgMassOmega;
14792  NuOut[iMarkerTP - 1][iSpan] = avgMassNu;
14793  }
14794 
14795  break;
14796 
14797  case MIXEDOUT:
14798  if (marker_flag == INFLOW){
14799  DensityIn[iMarkerTP - 1][iSpan] = avgMixDensity;
14800  PressureIn[iMarkerTP - 1][iSpan] = avgMixPressure;
14801  for (iDim = 0; iDim < nDim; iDim++) TurboVelocityIn[iMarkerTP -1][iSpan][iDim] = avgMixTurboVelocity[iDim];
14802  KineIn[iMarkerTP - 1][iSpan] = avgMixKine;
14803  OmegaIn[iMarkerTP - 1][iSpan] = avgMixOmega;
14804  NuIn[iMarkerTP - 1][iSpan] = avgMixNu;
14805  }
14806  else{
14807  DensityOut[iMarkerTP - 1][iSpan] = avgMixDensity;
14808  PressureOut[iMarkerTP - 1][iSpan] = avgMixPressure;
14809  for (iDim = 0; iDim < nDim; iDim++) TurboVelocityOut[iMarkerTP -1][iSpan][iDim] = avgMixTurboVelocity[iDim];
14810  KineOut[iMarkerTP - 1][iSpan] = avgMixKine;
14811  OmegaOut[iMarkerTP - 1][iSpan] = avgMixOmega;
14812  NuOut[iMarkerTP - 1][iSpan] = avgMixNu;
14813  }
14814  break;
14815 
14816  default:
14817  SU2_MPI::Error(" Invalid MIXING_PROCESS input!", CURRENT_FUNCTION);
14818  break;
14819  }
14820  }
14821  }
14822  }
14823  }
14824  }
14825 
14826 
14827 
14828  /*--- Compute Outlet Static Pressure if Radial equilibrium is imposed ---*/
14829 
14830  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++){
14831  for (iMarkerTP=1; iMarkerTP < config->GetnMarker_Turbomachinery()+1; iMarkerTP++){
14832  if (config->GetMarker_All_Turbomachinery(iMarker) == iMarkerTP){
14833  if (config->GetMarker_All_TurbomachineryFlag(iMarker) == marker_flag){
14834  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
14835  if(config->GetBoolGiles() || config->GetBoolRiemann()){
14836  if(config->GetBoolRiemann()){
14837  if(config->GetKind_Data_Riemann(Marker_Tag) == RADIAL_EQUILIBRIUM){
14838  RadialEquilibriumPressure[iMarker][nSpanWiseSections/2] = config->GetRiemann_Var1(Marker_Tag)/config->GetPressure_Ref();
14839  for (iSpan= nSpanWiseSections/2; iSpan < nSpanWiseSections-1; iSpan++){
14840  Radius2 = geometry->GetTurboRadius(iMarker,iSpan+1);
14841  Radius1 = geometry->GetTurboRadius(iMarker,iSpan);
14842  Vt2 = AverageTurboVelocity[iMarker][iSpan +1][1]*AverageTurboVelocity[iMarker][iSpan +1][1];
14843  RadialEquilibriumPressure[iMarker][iSpan +1] = RadialEquilibriumPressure[iMarker][iSpan] + AverageDensity[iMarker][iSpan +1]*Vt2/Radius2*(Radius2 - Radius1);
14844  }
14845  for (iSpan= nSpanWiseSections/2; iSpan > 0; iSpan--){
14846  Radius2 = geometry->GetTurboRadius(iMarker,iSpan);
14847  Radius1 = geometry->GetTurboRadius(iMarker,iSpan-1);
14848  Vt2 = AverageTurboVelocity[iMarker][iSpan - 1][1]*AverageTurboVelocity[iMarker][iSpan - 1][1];
14849  RadialEquilibriumPressure[iMarker][iSpan -1] = RadialEquilibriumPressure[iMarker][iSpan] - AverageDensity[iMarker][iSpan -1]*Vt2/Radius2*(Radius2 - Radius1);
14850  }
14851  }
14852  }
14853  else{
14854  if(config->GetKind_Data_Giles(Marker_Tag) == RADIAL_EQUILIBRIUM){
14855  RadialEquilibriumPressure[iMarker][nSpanWiseSections/2] = config->GetGiles_Var1(Marker_Tag)/config->GetPressure_Ref();
14856  for (iSpan= nSpanWiseSections/2; iSpan < nSpanWiseSections-1; iSpan++){
14857  Radius2 = geometry->GetTurboRadius(iMarker,iSpan+1);
14858  Radius1 = geometry->GetTurboRadius(iMarker,iSpan);
14859  Vt2 = AverageTurboVelocity[iMarker][iSpan +1][1]*AverageTurboVelocity[iMarker][iSpan +1][1];
14860  RadialEquilibriumPressure[iMarker][iSpan +1] = RadialEquilibriumPressure[iMarker][iSpan] + AverageDensity[iMarker][iSpan +1]*Vt2/Radius2*(Radius2 - Radius1);
14861  }
14862  for (iSpan= nSpanWiseSections/2; iSpan > 0; iSpan--){
14863  Radius2 = geometry->GetTurboRadius(iMarker,iSpan);
14864  Radius1 = geometry->GetTurboRadius(iMarker,iSpan-1);
14865  Vt2 = AverageTurboVelocity[iMarker][iSpan -1][1]*AverageTurboVelocity[iMarker][iSpan - 1][1];
14866  RadialEquilibriumPressure[iMarker][iSpan -1] = RadialEquilibriumPressure[iMarker][iSpan] - AverageDensity[iMarker][iSpan -1]*Vt2/Radius2*(Radius2 - Radius1);
14867  }
14868  }
14869  }
14870  }
14871  }
14872  }
14873  }
14874  }
14875 
14876  /*--- Free locally allocated memory ---*/
14877  delete [] Velocity;
14878  delete [] UnitNormal;
14879  delete [] TurboNormal;
14880  delete [] TurboVelocity;
14881  delete [] TotalVelocity;
14882  delete [] TotalAreaVelocity;
14883  delete [] TotalFluxes;
14884  delete [] TotalMassVelocity;
14885  delete [] avgVelocity;
14886  delete [] avgAreaVelocity;
14887  delete [] avgMassVelocity;
14888  delete [] avgMixVelocity;
14889  delete [] avgMixTurboVelocity;
14890 
14891 }
14892 
14893 void CEulerSolver::MixedOut_Average (CConfig *config, su2double val_init_pressure, su2double *val_Averaged_Flux, su2double *val_normal,
14894  su2double& pressure_mix, su2double& density_mix) {
14895 
14896 
14897  su2double dx, f, df, resdl = 1.0E+05;
14898  unsigned short iter = 0, iDim;
14899  su2double relax_factor = config->GetMixedout_Coeff(0);
14900  su2double toll = config->GetMixedout_Coeff(1);
14901  unsigned short maxiter = SU2_TYPE::Int(config->GetMixedout_Coeff(2));
14902  su2double dhdP, dhdrho, enthalpy_mix, velsq, *vel;
14903 
14904  vel = new su2double[nDim];
14905 
14906  pressure_mix = val_init_pressure;
14907 
14908  /*--- Newton-Raphson's method with central difference formula ---*/
14909 
14910  while ( iter <= maxiter ) {
14911 
14912  density_mix = val_Averaged_Flux[0]*val_Averaged_Flux[0]/(val_Averaged_Flux[1] - pressure_mix);
14913  FluidModel->SetTDState_Prho(pressure_mix, density_mix);
14914  enthalpy_mix = FluidModel->GetStaticEnergy() + (pressure_mix)/(density_mix);
14915 
14916  FluidModel->ComputeDerivativeNRBC_Prho(pressure_mix, density_mix);
14917  dhdP = FluidModel->GetdhdP_rho();
14918  dhdrho = FluidModel->Getdhdrho_P();
14919 
14920  vel[0] = (val_Averaged_Flux[1] - pressure_mix) / val_Averaged_Flux[0];
14921  for (iDim = 1; iDim < nDim; iDim++) {
14922  vel[iDim] = val_Averaged_Flux[iDim+1] / val_Averaged_Flux[0];
14923  }
14924 
14925  velsq = 0.0;
14926  for (unsigned short iDim = 0; iDim < nDim; iDim++) {
14927  velsq += vel[iDim]*vel[iDim];
14928  }
14929  f = val_Averaged_Flux[nDim+1] - val_Averaged_Flux[0]*(enthalpy_mix + velsq/2);
14930  df = -val_Averaged_Flux[0]*(dhdP - 1/density_mix) - dhdrho*density_mix*density_mix/val_Averaged_Flux[0];
14931  dx = -f/df;
14932  resdl = dx/val_init_pressure;
14933  pressure_mix += relax_factor*dx;
14934 
14935  iter += 1;
14936  if ( abs(resdl) <= toll ) {
14937  break;
14938  }
14939 
14940  }
14941 
14942  density_mix = val_Averaged_Flux[0]*val_Averaged_Flux[0]/(val_Averaged_Flux[1] - pressure_mix);
14943 
14944 
14945  delete [] vel;
14946 
14947 }
14948 
14950 
14951  unsigned short iMarker, iMarkerTP;
14952  unsigned short iSpan;
14953  int markerTP;
14954  su2double densityIn, pressureIn, normalVelocityIn, tangVelocityIn, radialVelocityIn;
14955  su2double densityOut, pressureOut, normalVelocityOut, tangVelocityOut, radialVelocityOut;
14956  su2double kineIn, omegaIn, nuIn, kineOut, omegaOut, nuOut;
14957  //TODO (turbo) implement interpolation so that Inflow and Outflow spanwise section can be different
14958 
14959  for (iSpan= 0; iSpan < nSpanWiseSections + 1 ; iSpan++) {
14960 
14961 #ifdef HAVE_MPI
14962  unsigned short i, n1, n2, n1t,n2t;
14963  su2double *TurbPerfIn= NULL,*TurbPerfOut= NULL;
14964  su2double *TotTurbPerfIn = NULL,*TotTurbPerfOut = NULL;
14965  int *TotMarkerTP = NULL;
14966 
14967  n1 = 8;
14968  n2 = 8;
14969  n1t = n1*size;
14970  n2t = n2*size;
14971  TurbPerfIn = new su2double[n1];
14972  TurbPerfOut = new su2double[n2];
14973 
14974  for (i=0;i<n1;i++)
14975  TurbPerfIn[i] = -1.0;
14976  for (i=0;i<n2;i++)
14977  TurbPerfOut[i] = -1.0;
14978 #endif
14979 
14980 
14981  densityIn = -1.0;
14982  pressureIn = -1.0;
14983  normalVelocityIn = -1.0;
14984  tangVelocityIn = -1.0;
14985  radialVelocityIn = -1.0;
14986  densityOut = -1.0;
14987  pressureOut = -1.0;
14988  normalVelocityOut = -1.0;
14989  tangVelocityOut = -1.0;
14990  radialVelocityOut = -1.0;
14991  kineIn = -1.0;
14992  omegaIn = -1.0;
14993  nuIn = -1.0;
14994  kineOut = -1.0;
14995  omegaOut = -1.0;
14996  nuOut = -1.0;
14997 
14998 
14999  markerTP = -1;
15000 
15001  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++){
15002  for (iMarkerTP = 1; iMarkerTP < config->GetnMarker_Turbomachinery()+1; iMarkerTP++){
15003  if (config->GetMarker_All_Turbomachinery(iMarker) == iMarkerTP){
15004  if (config->GetMarker_All_TurbomachineryFlag(iMarker) == INFLOW){
15005  markerTP = iMarkerTP;
15006  densityIn = DensityIn[iMarkerTP -1][iSpan];
15007  pressureIn = PressureIn[iMarkerTP -1][iSpan];
15008  normalVelocityIn = TurboVelocityIn[iMarkerTP -1][iSpan][0];
15009  tangVelocityIn = TurboVelocityIn[iMarkerTP -1][iSpan][1];
15010  if (nDim ==3){
15011  radialVelocityIn = TurboVelocityIn[iMarkerTP -1][iSpan][2];
15012  }
15013  kineIn = KineIn[iMarkerTP -1][iSpan];
15014  omegaIn = OmegaIn[iMarkerTP -1][iSpan];
15015  nuIn = NuIn[iMarkerTP -1][iSpan];
15016 
15017 
15018 #ifdef HAVE_MPI
15019  TurbPerfIn[0] = densityIn;
15020  TurbPerfIn[1] = pressureIn;
15021  TurbPerfIn[2] = normalVelocityIn;
15022  TurbPerfIn[3] = tangVelocityIn;
15023  TurbPerfIn[4] = radialVelocityIn;
15024  TurbPerfIn[5] = kineIn;
15025  TurbPerfIn[6] = omegaIn;
15026  TurbPerfIn[7] = nuIn;
15027 #endif
15028  }
15029 
15030  /*--- retrieve outlet information ---*/
15031  if (config->GetMarker_All_TurbomachineryFlag(iMarker) == OUTFLOW){
15032  densityOut = DensityOut[iMarkerTP -1][iSpan];
15033  pressureOut = PressureOut[iMarkerTP -1][iSpan];
15034  normalVelocityOut = TurboVelocityOut[iMarkerTP -1][iSpan][0];
15035  tangVelocityOut = TurboVelocityOut[iMarkerTP -1][iSpan][1];
15036  if (nDim ==3){
15037  radialVelocityOut = TurboVelocityOut[iMarkerTP -1][iSpan][2];
15038  }
15039  kineOut = KineOut[iMarkerTP -1][iSpan];
15040  omegaOut = OmegaOut[iMarkerTP -1][iSpan];
15041  nuOut = NuOut[iMarkerTP -1][iSpan];
15042 
15043 
15044 
15045 #ifdef HAVE_MPI
15046  TurbPerfOut[0] = densityOut;
15047  TurbPerfOut[1] = pressureOut;
15048  TurbPerfOut[2] = normalVelocityOut;
15049  TurbPerfOut[3] = tangVelocityOut;
15050  TurbPerfOut[4] = radialVelocityOut;
15051  TurbPerfOut[5] = kineOut;
15052  TurbPerfOut[6] = omegaOut;
15053  TurbPerfOut[7] = nuOut;
15054 #endif
15055  }
15056  }
15057  }
15058  }
15059 
15060 #ifdef HAVE_MPI
15061  if (rank == MASTER_NODE){
15062  TotTurbPerfIn = new su2double[n1t];
15063  TotTurbPerfOut = new su2double[n2t];
15064  for (i=0;i<n1t;i++)
15065  TotTurbPerfIn[i] = -1.0;
15066  for (i=0;i<n2t;i++)
15067  TotTurbPerfOut[i] = -1.0;
15068  TotMarkerTP = new int[size];
15069  for(i=0; i<size; i++){
15070  TotMarkerTP[i] = -1;
15071  }
15072  }
15073  SU2_MPI::Gather(TurbPerfIn, n1, MPI_DOUBLE, TotTurbPerfIn, n1, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD);
15074  SU2_MPI::Gather(TurbPerfOut, n2, MPI_DOUBLE,TotTurbPerfOut, n2, MPI_DOUBLE, MASTER_NODE, MPI_COMM_WORLD);
15075  SU2_MPI::Gather(&markerTP, 1, MPI_INT,TotMarkerTP, 1, MPI_INT, MASTER_NODE, MPI_COMM_WORLD);
15076  if (rank == MASTER_NODE){
15077  delete [] TurbPerfIn, delete [] TurbPerfOut;
15078  }
15079 
15080  if (rank == MASTER_NODE){
15081  for (i=0;i<size;i++){
15082  if(TotTurbPerfIn[n1*i] > 0.0){
15083  densityIn = 0.0;
15084  densityIn = TotTurbPerfIn[n1*i];
15085  pressureIn = 0.0;
15086  pressureIn = TotTurbPerfIn[n1*i+1];
15087  normalVelocityIn = 0.0;
15088  normalVelocityIn = TotTurbPerfIn[n1*i+2];
15089  tangVelocityIn = 0.0;
15090  tangVelocityIn = TotTurbPerfIn[n1*i+3];
15091  radialVelocityIn = 0.0;
15092  radialVelocityIn = TotTurbPerfIn[n1*i+4];
15093  kineIn = 0.0;
15094  kineIn = TotTurbPerfIn[n1*i+5];
15095  omegaIn = 0.0;
15096  omegaIn = TotTurbPerfIn[n1*i+6];
15097  nuIn = 0.0;
15098  nuIn = TotTurbPerfIn[n1*i+7];
15099 
15100  markerTP = -1;
15101  markerTP = TotMarkerTP[i];
15102  }
15103 
15104  if(TotTurbPerfOut[n2*i] > 0.0){
15105  densityOut = 0.0;
15106  densityOut = TotTurbPerfOut[n1*i];
15107  pressureOut = 0.0;
15108  pressureOut = TotTurbPerfOut[n1*i+1];
15109  normalVelocityOut = 0.0;
15110  normalVelocityOut = TotTurbPerfOut[n1*i+2];
15111  tangVelocityOut = 0.0;
15112  tangVelocityOut = TotTurbPerfOut[n1*i+3];
15113  radialVelocityOut = 0.0;
15114  radialVelocityOut = TotTurbPerfOut[n1*i+4];
15115  kineOut = 0.0;
15116  kineOut = TotTurbPerfOut[n1*i+5];
15117  omegaOut = 0.0;
15118  omegaOut = TotTurbPerfOut[n1*i+6];
15119  nuOut = 0.0;
15120  nuOut = TotTurbPerfOut[n1*i+7];
15121  }
15122  }
15123 
15124  delete [] TotTurbPerfIn, delete [] TotTurbPerfOut; delete [] TotMarkerTP;
15125  }
15126 
15127 #endif
15128 
15129  if (rank == MASTER_NODE && markerTP > -1){
15130  /*----Quantities needed for computing the turbomachinery performance -----*/
15131  DensityIn[markerTP -1][iSpan] = densityIn;
15132  PressureIn[markerTP -1][iSpan] = pressureIn;
15133  TurboVelocityIn[markerTP -1][iSpan][0] = normalVelocityIn;
15134  TurboVelocityIn[markerTP -1][iSpan][1] = tangVelocityIn;
15135  if (nDim == 3)
15136  TurboVelocityIn[markerTP -1][iSpan][2] = radialVelocityIn;
15137  KineIn[markerTP -1][iSpan] = kineIn;
15138  OmegaIn[markerTP -1][iSpan] = omegaIn;
15139  NuIn[markerTP -1][iSpan] = nuIn;
15140 
15141  DensityOut[markerTP -1][iSpan] = densityOut;
15142  PressureOut[markerTP -1][iSpan] = pressureOut;
15143  TurboVelocityOut[markerTP -1][iSpan][0] = normalVelocityOut;
15144  TurboVelocityOut[markerTP -1][iSpan][1] = tangVelocityOut;
15145  if (nDim == 3)
15146  TurboVelocityOut[markerTP -1][iSpan][2] = radialVelocityOut;
15147  KineOut[markerTP -1][iSpan] = kineOut;
15148  OmegaOut[markerTP -1][iSpan] = omegaOut;
15149  NuOut[markerTP -1][iSpan] = nuOut;
15150  }
15151  }
15152 }
15153 
15155 
15156  /*--- Basic array initialization ---*/
15157 
15158  CD_Visc = NULL; CL_Visc = NULL; CSF_Visc = NULL; CEff_Visc = NULL;
15159  CFx_Visc = NULL; CFy_Visc = NULL; CFz_Visc = NULL;
15160  CMx_Visc = NULL; CMy_Visc = NULL; CMz_Visc = NULL;
15161  CoPx_Visc = NULL; CoPy_Visc = NULL; CoPz_Visc = NULL;
15162 
15163  ForceViscous = NULL; MomentViscous = NULL; CSkinFriction = NULL;
15164 
15165  Buffet_Sensor = NULL; Buffet_Metric = NULL;
15166 
15167  /*--- Surface based array initialization ---*/
15168 
15169  Surface_CL_Visc = NULL; Surface_CD_Visc = NULL; Surface_CSF_Visc = NULL; Surface_CEff_Visc = NULL;
15170  Surface_CFx_Visc = NULL; Surface_CFy_Visc = NULL; Surface_CFz_Visc = NULL;
15171  Surface_CMx_Visc = NULL; Surface_CMy_Visc = NULL; Surface_CMz_Visc = NULL;
15172  Surface_HF_Visc = NULL; Surface_MaxHF_Visc = NULL; Surface_Buffet_Metric = NULL;
15173 
15174  /*--- Rotorcraft simulation array initialization ---*/
15175 
15176  CMerit_Visc = NULL; CT_Visc = NULL; CQ_Visc = NULL;
15177 
15178  /*--- Inlet Variables ---*/
15179  Inlet_Ttotal = NULL;
15180  Inlet_Ptotal = NULL;
15181  Inlet_FlowDir = NULL;
15182 
15183  SlidingState = NULL;
15184  SlidingStateNodes = NULL;
15185 
15186 }
15187 
15188 CNSSolver::CNSSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) : CEulerSolver() {
15189 
15190  unsigned long iPoint, counter_local = 0, counter_global = 0, iVertex;
15191  unsigned short iVar, iDim, iMarker, nLineLets;
15192  su2double Density, Velocity2, Pressure, Temperature, StaticEnergy;
15193  ifstream restart_file;
15194  unsigned short nZone = geometry->GetnZone();
15195  bool restart = (config->GetRestart() || config->GetRestart_Flow());
15196  int Unst_RestartIter;
15197  unsigned short iZone = config->GetiZone();
15198  bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) ||
15199  (config->GetUnsteady_Simulation() == DT_STEPPING_2ND));
15200  bool time_stepping = config->GetUnsteady_Simulation() == TIME_STEPPING;
15201 
15202  bool roe_turkel = (config->GetKind_Upwind_Flow() == TURKEL);
15203  bool low_mach_prec = config->Low_Mach_Preconditioning();
15204 
15205  bool adjoint = (config->GetContinuous_Adjoint()) || (config->GetDiscrete_Adjoint());
15206  bool transp = (config->GetnMarker_Transpiration() > 0);
15207  string filename_ = config->GetSolution_FlowFileName();
15208 
15209  unsigned short direct_diff = config->GetDirectDiff();
15210  bool rans = ((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS));
15211  bool fsi = config->GetFSI_Simulation();
15212 
15213  /*--- Check for a restart file to evaluate if there is a change in the angle of attack
15214  before computing all the non-dimesional quantities. ---*/
15215 
15216  if (!(!restart || (iMesh != MESH_0) || nZone > 1)) {
15217 
15218  /*--- Multizone problems require the number of the zone to be appended. ---*/
15219 
15220  if (nZone > 1) filename_ = config->GetMultizone_FileName(filename_, iZone);
15221 
15222  /*--- Modify file name for a dual-time unsteady restart ---*/
15223 
15224  if (dual_time) {
15225  if (adjoint) Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_AdjointIter())-1;
15226  else if (config->GetUnsteady_Simulation() == DT_STEPPING_1ST)
15227  Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_RestartIter())-1;
15228  else Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_RestartIter())-2;
15229  filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter);
15230  }
15231 
15232  /*--- Modify file name for a time stepping unsteady restart ---*/
15233 
15234  if (time_stepping) {
15235  if (adjoint) Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_AdjointIter())-1;
15236  else Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_RestartIter())-1;
15237  filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter);
15238  }
15239 
15240  /*--- Read and store the restart metadata. ---*/
15241 
15242  Read_SU2_Restart_Metadata(geometry, config, false, filename_);
15243 
15244  }
15245 
15246  /*--- Array initialization ---*/
15247 
15248  CD_Visc = NULL; CL_Visc = NULL; CSF_Visc = NULL; CEff_Visc = NULL;
15249  CFx_Visc = NULL; CFy_Visc = NULL; CFz_Visc = NULL;
15250  CMx_Visc = NULL; CMy_Visc = NULL; CMz_Visc = NULL;
15251  CoPx_Visc = NULL; CoPy_Visc = NULL; CoPz_Visc = NULL;
15252 
15253  Buffet_Sensor = NULL; Buffet_Metric = NULL;
15254 
15255  Surface_CL_Visc = NULL; Surface_CD_Visc = NULL; Surface_CSF_Visc = NULL; Surface_CEff_Visc = NULL;
15256  Surface_CFx_Visc = NULL; Surface_CFy_Visc = NULL; Surface_CFz_Visc = NULL;
15257  Surface_CMx_Visc = NULL; Surface_CMy_Visc = NULL; Surface_CMz_Visc = NULL;
15258  Surface_HF_Visc = NULL; Surface_MaxHF_Visc = NULL;
15259 
15260  Surface_Buffet_Metric = NULL;
15261 
15262  CMerit_Visc = NULL; CT_Visc = NULL; CQ_Visc = NULL;
15263  MaxHF_Visc = NULL; ForceViscous = NULL; MomentViscous = NULL;
15264  CSkinFriction = NULL; Cauchy_Serie = NULL; HF_Visc = NULL;
15265  HeatConjugateVar = NULL;
15266 
15267  /*--- Initialize quantities for the average process for internal flow ---*/
15268 
15269  AverageVelocity = NULL;
15270  AverageTurboVelocity = NULL;
15271  OldAverageTurboVelocity = NULL;
15272  ExtAverageTurboVelocity = NULL;
15273  AverageFlux = NULL;
15274  SpanTotalFlux = NULL;
15275  AveragePressure = NULL;
15276  OldAveragePressure = NULL;
15278  ExtAveragePressure = NULL;
15279  AverageDensity = NULL;
15280  OldAverageDensity = NULL;
15281  ExtAverageDensity = NULL;
15282  AverageNu = NULL;
15283  AverageKine = NULL;
15284  AverageOmega = NULL;
15285  ExtAverageNu = NULL;
15286  ExtAverageKine = NULL;
15287  ExtAverageOmega = NULL;
15288 
15289 
15290  /*--- Initialize primitive quantities for turboperformace ---*/
15291 
15292  DensityIn = NULL;
15293  PressureIn = NULL;
15294  TurboVelocityIn = NULL;
15295  DensityOut = NULL;
15296  PressureOut = NULL;
15297  TurboVelocityOut = NULL;
15298 
15299 
15300  /*--- Initialize quantities for Giles BC ---*/
15301 
15302  CkInflow = NULL;
15303  CkOutflow1 = NULL;
15304  CkOutflow2 = NULL;
15305 
15306 
15307 
15308  /*--- Set the gamma value ---*/
15309 
15310  Gamma = config->GetGamma();
15311  Gamma_Minus_One = Gamma - 1.0;
15312 
15313  /*--- Define geometry constants in the solver structure
15314  Compressible flow, primitive variables (T, vx, vy, vz, P, rho, h, c, lamMu, EddyMu, ThCond, Cp).
15315  ---*/
15316 
15317  nDim = geometry->GetnDim();
15318 
15319  nVar = nDim+2;
15320  nPrimVar = nDim+9; nPrimVarGrad = nDim+4;
15322 
15323 
15324  /*--- Initialize nVarGrad for deallocation ---*/
15325 
15327 
15328  nMarker = config->GetnMarker_All();
15329  nPoint = geometry->GetnPoint();
15330  nPointDomain = geometry->GetnPointDomain();
15331 
15332  /*--- Store the number of vertices on each marker for deallocation later ---*/
15333 
15334  nVertex = new unsigned long[nMarker];
15335  for (iMarker = 0; iMarker < nMarker; iMarker++)
15336  nVertex[iMarker] = geometry->nVertex[iMarker];
15337 
15338  /*--- Perform the non-dimensionalization for the flow equations using the
15339  specified reference values. ---*/
15340 
15341  SetNondimensionalization(config, iMesh);
15342 
15343  /*--- Allocate the node variables ---*/
15344  node = new CVariable*[nPoint];
15345 
15346  /*--- Define some auxiliar vector related with the residual ---*/
15347 
15348  Residual = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual[iVar] = 0.0;
15349  Residual_RMS = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_RMS[iVar] = 0.0;
15350  Residual_Max = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_Max[iVar] = 0.0;
15351  Residual_i = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_i[iVar] = 0.0;
15352  Residual_j = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_j[iVar] = 0.0;
15353  Res_Conv = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Res_Conv[iVar] = 0.0;
15354  Res_Visc = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Res_Visc[iVar] = 0.0;
15355  Res_Sour = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Res_Sour[iVar] = 0.0;
15356 
15357  /*--- Define some structures for locating max residuals ---*/
15358 
15359  Point_Max = new unsigned long[nVar]; for (iVar = 0; iVar < nVar; iVar++) Point_Max[iVar] = 0;
15360  Point_Max_Coord = new su2double*[nVar];
15361  for (iVar = 0; iVar < nVar; iVar++) {
15362  Point_Max_Coord[iVar] = new su2double[nDim];
15363  for (iDim = 0; iDim < nDim; iDim++) Point_Max_Coord[iVar][iDim] = 0.0;
15364  }
15365 
15366  /*--- Define some auxiliary vectors related to the solution ---*/
15367 
15368  Solution = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Solution[iVar] = 0.0;
15369  Solution_i = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Solution_i[iVar] = 0.0;
15370  Solution_j = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Solution_j[iVar] = 0.0;
15371 
15372  /*--- Define some auxiliary vectors related to the geometry ---*/
15373 
15374  Vector = new su2double[nDim]; for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = 0.0;
15375  Vector_i = new su2double[nDim]; for (iDim = 0; iDim < nDim; iDim++) Vector_i[iDim] = 0.0;
15376  Vector_j = new su2double[nDim]; for (iDim = 0; iDim < nDim; iDim++) Vector_j[iDim] = 0.0;
15377 
15378  /*--- Define some auxiliary vectors related to the primitive solution ---*/
15379 
15380  Primitive = new su2double[nPrimVar]; for (iVar = 0; iVar < nPrimVar; iVar++) Primitive[iVar] = 0.0;
15381  Primitive_i = new su2double[nPrimVar]; for (iVar = 0; iVar < nPrimVar; iVar++) Primitive_i[iVar] = 0.0;
15382  Primitive_j = new su2double[nPrimVar]; for (iVar = 0; iVar < nPrimVar; iVar++) Primitive_j[iVar] = 0.0;
15383 
15384  /*--- Define some auxiliary vectors related to the Secondary solution ---*/
15385 
15386  Secondary = new su2double[nSecondaryVar]; for (iVar = 0; iVar < nSecondaryVar; iVar++) Secondary[iVar] = 0.0;
15387  Secondary_i = new su2double[nSecondaryVar]; for (iVar = 0; iVar < nSecondaryVar; iVar++) Secondary_i[iVar] = 0.0;
15388  Secondary_j = new su2double[nSecondaryVar]; for (iVar = 0; iVar < nSecondaryVar; iVar++) Secondary_j[iVar] = 0.0;
15389 
15390  /*--- Define some auxiliar vector related with the undivided lapalacian computation ---*/
15391 
15392  if (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) {
15395  }
15396 
15397  /*--- Define some auxiliary vectors related to low-speed preconditioning ---*/
15398 
15399  if (roe_turkel || low_mach_prec) {
15401  for (iVar = 0; iVar < nVar; iVar ++)
15402  LowMach_Precontioner[iVar] = new su2double[nVar];
15403  }
15404 
15405  /*--- Initialize the solution and right hand side vectors for storing
15406  the residuals and updating the solution (always needed even for
15407  explicit schemes). ---*/
15408 
15411 
15412  /*--- Jacobians and vector structures for implicit computations ---*/
15413 
15414  if (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT) {
15415 
15416  Jacobian_i = new su2double* [nVar];
15417  Jacobian_j = new su2double* [nVar];
15418  for (iVar = 0; iVar < nVar; iVar++) {
15419  Jacobian_i[iVar] = new su2double [nVar];
15420  Jacobian_j[iVar] = new su2double [nVar];
15421  }
15422 
15423  if (rank == MASTER_NODE) cout << "Initialize Jacobian structure (Navier-Stokes). MG level: " << iMesh <<"." << endl;
15424  Jacobian.Initialize(nPoint, nPointDomain, nVar, nVar, true, geometry, config);
15425 
15426  if ((config->GetKind_Linear_Solver_Prec() == LINELET) ||
15427  (config->GetKind_Linear_Solver() == SMOOTHER_LINELET)) {
15428  nLineLets = Jacobian.BuildLineletPreconditioner(geometry, config);
15429  if (rank == MASTER_NODE) cout << "Compute linelet structure. " << nLineLets << " elements in each line (average)." << endl;
15430  }
15431 
15432  }
15433 
15434  else {
15435  if (rank == MASTER_NODE)
15436  cout << "Explicit scheme. No Jacobian structure (Navier-Stokes). MG level: " << iMesh <<"." << endl;
15437  }
15438 
15439  /*--- Define some auxiliary vectors for computing flow variable
15440  gradients by least squares, S matrix := inv(R)*traspose(inv(R)),
15441  c vector := transpose(WA)*(Wb) ---*/
15442 
15444 
15445  Smatrix = new su2double* [nDim];
15446  for (iDim = 0; iDim < nDim; iDim++)
15447  Smatrix[iDim] = new su2double [nDim];
15448 
15449  Cvector = new su2double* [nPrimVarGrad];
15450  for (iVar = 0; iVar < nPrimVarGrad; iVar++)
15451  Cvector[iVar] = new su2double [nDim];
15452  }
15453 
15454  /*--- Store the value of the characteristic primitive variables at the boundaries ---*/
15455 
15456  CharacPrimVar = new su2double** [nMarker];
15457  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15458  CharacPrimVar[iMarker] = new su2double* [geometry->nVertex[iMarker]];
15459  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15460  CharacPrimVar[iMarker][iVertex] = new su2double [nPrimVar];
15461  for (iVar = 0; iVar < nPrimVar; iVar++) {
15462  CharacPrimVar[iMarker][iVertex][iVar] = 0.0;
15463  }
15464  }
15465  }
15466 
15467  /*--- Store the value of the primitive variables + 2 turb variables at the boundaries,
15468  used for IO with a donor cell ---*/
15469 
15470  DonorPrimVar = new su2double** [nMarker];
15471  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15472  DonorPrimVar[iMarker] = new su2double* [geometry->nVertex[iMarker]];
15473  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15474  if (rans) {
15475  DonorPrimVar[iMarker][iVertex] = new su2double [nPrimVar+2];
15476  for (iVar = 0; iVar < nPrimVar + 2 ; iVar++) {
15477  DonorPrimVar[iMarker][iVertex][iVar] = 0.0;
15478  }
15479  }
15480  else {
15481  DonorPrimVar[iMarker][iVertex] = new su2double [nPrimVar];
15482  for (iVar = 0; iVar < nPrimVar ; iVar++) {
15483  DonorPrimVar[iMarker][iVertex][iVar] = 0.0;
15484  }
15485  }
15486  }
15487  }
15488 
15489  /*--- Store the values of the temperature and the heat flux density at the boundaries,
15490  used for coupling with a solid donor cell ---*/
15491  unsigned short nHeatConjugateVar = 4;
15492 
15493  HeatConjugateVar = new su2double** [nMarker];
15494  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15495  HeatConjugateVar[iMarker] = new su2double* [geometry->nVertex[iMarker]];
15496  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15497 
15498  HeatConjugateVar[iMarker][iVertex] = new su2double [nHeatConjugateVar];
15499  for (iVar = 1; iVar < nHeatConjugateVar ; iVar++) {
15500  HeatConjugateVar[iMarker][iVertex][iVar] = 0.0;
15501  }
15502  HeatConjugateVar[iMarker][iVertex][0] = config->GetTemperature_FreeStreamND();
15503  }
15504  }
15505 
15506  /*--- Store the value of the characteristic primitive variables at the boundaries ---*/
15507 
15508  DonorGlobalIndex = new unsigned long* [nMarker];
15509  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15510  DonorGlobalIndex[iMarker] = new unsigned long [geometry->nVertex[iMarker]];
15511  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15512  DonorGlobalIndex[iMarker][iVertex] = 0;
15513  }
15514  }
15515 
15516  /*--- Store the value of the Delta P at the Actuator Disk ---*/
15517 
15518  ActDisk_DeltaP = new su2double* [nMarker];
15519  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15520  ActDisk_DeltaP[iMarker] = new su2double [geometry->nVertex[iMarker]];
15521  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15522  ActDisk_DeltaP[iMarker][iVertex] = 0;
15523  }
15524  }
15525 
15526  /*--- Store the value of the Delta T at the Actuator Disk ---*/
15527 
15528  ActDisk_DeltaT = new su2double* [nMarker];
15529  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15530  ActDisk_DeltaT[iMarker] = new su2double [geometry->nVertex[iMarker]];
15531  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15532  ActDisk_DeltaT[iMarker][iVertex] = 0;
15533  }
15534  }
15535 
15536  /*--- Store the value of the Total Pressure at the inlet BC ---*/
15537 
15538  Inlet_Ttotal = new su2double* [nMarker];
15539  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15540  Inlet_Ttotal[iMarker] = new su2double [geometry->nVertex[iMarker]];
15541  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15542  Inlet_Ttotal[iMarker][iVertex] = 0;
15543  }
15544  }
15545 
15546  /*--- Store the value of the Total Temperature at the inlet BC ---*/
15547 
15548  Inlet_Ptotal = new su2double* [nMarker];
15549  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15550  Inlet_Ptotal[iMarker] = new su2double [geometry->nVertex[iMarker]];
15551  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15552  Inlet_Ptotal[iMarker][iVertex] = 0;
15553  }
15554  }
15555 
15556  /*--- Store the value of the Flow direction at the inlet BC ---*/
15557 
15558  Inlet_FlowDir = new su2double** [nMarker];
15559  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15560  Inlet_FlowDir[iMarker] = new su2double* [geometry->nVertex[iMarker]];
15561  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15562  Inlet_FlowDir[iMarker][iVertex] = new su2double [nDim];
15563  for (iDim = 0; iDim < nDim; iDim++) {
15564  Inlet_FlowDir[iMarker][iVertex][iDim] = 0;
15565  }
15566  }
15567  }
15568 
15569  /*--- Inviscid force definition and coefficient in all the markers ---*/
15570 
15571  CPressure = new su2double* [nMarker];
15573  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15574  CPressure[iMarker] = new su2double [geometry->nVertex[iMarker]];
15575  CPressureTarget[iMarker] = new su2double [geometry->nVertex[iMarker]];
15576  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15577  CPressure[iMarker][iVertex] = 0.0;
15578  CPressureTarget[iMarker][iVertex] = 0.0;
15579  }
15580  }
15581 
15582  /*--- Heat flux in all the markers ---*/
15583 
15584  HeatFlux = new su2double* [nMarker];
15585  HeatFluxTarget = new su2double* [nMarker];
15586  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15587  HeatFlux[iMarker] = new su2double [geometry->nVertex[iMarker]];
15588  HeatFluxTarget[iMarker] = new su2double [geometry->nVertex[iMarker]];
15589  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15590  HeatFlux[iMarker][iVertex] = 0.0;
15591  HeatFluxTarget[iMarker][iVertex] = 0.0;
15592  }
15593  }
15594 
15595  /*--- Y plus in all the markers ---*/
15596 
15597  YPlus = new su2double* [nMarker];
15598  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15599  YPlus[iMarker] = new su2double [geometry->nVertex[iMarker]];
15600  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15601  YPlus[iMarker][iVertex] = 0.0;
15602  }
15603  }
15604 
15605  /*--- Skin friction in all the markers ---*/
15606 
15607  CSkinFriction = new su2double** [nMarker];
15608  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15609  CSkinFriction[iMarker] = new su2double*[nDim];
15610  for (iDim = 0; iDim < nDim; iDim++) {
15611  CSkinFriction[iMarker][iDim] = new su2double[geometry->nVertex[iMarker]];
15612  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
15613  CSkinFriction[iMarker][iDim][iVertex] = 0.0;
15614  }
15615  }
15616  }
15617 
15618  /*--- Buffet sensor in all the markers ---*/
15619 
15620  if(config->GetBuffet_Monitoring() || config->GetKind_ObjFunc() == BUFFET_SENSOR){
15621 
15622  Buffet_Sensor = new su2double*[nMarker];
15623  for(iMarker = 0; iMarker < nMarker; iMarker++) {
15624  Buffet_Sensor[iMarker] = new su2double[geometry->nVertex[iMarker]];
15625  }
15626 
15627  }
15628 
15629  /*--- Non dimensional coefficients ---*/
15630 
15631  ForceInviscid = new su2double[3];
15632  MomentInviscid = new su2double[3];
15633  CD_Inv = new su2double[nMarker];
15634  CL_Inv = new su2double[nMarker];
15635  CSF_Inv = new su2double[nMarker];
15636  CEff_Inv = new su2double[nMarker];
15637  CFx_Inv = new su2double[nMarker];
15638  CFy_Inv = new su2double[nMarker];
15639  CFz_Inv = new su2double[nMarker];
15640  CMx_Inv = new su2double[nMarker];
15641  CMy_Inv = new su2double[nMarker];
15642  CMz_Inv = new su2double[nMarker];
15643  CoPx_Inv = new su2double[nMarker];
15644  CoPy_Inv = new su2double[nMarker];
15645  CoPz_Inv = new su2double[nMarker];
15646 
15647  ForceMomentum = new su2double[3];
15648  MomentMomentum = new su2double[3];
15649  CD_Mnt = new su2double[nMarker];
15650  CL_Mnt = new su2double[nMarker];
15651  CSF_Mnt = new su2double[nMarker];
15652  CEff_Mnt = new su2double[nMarker];
15653  CFx_Mnt = new su2double[nMarker];
15654  CFy_Mnt = new su2double[nMarker];
15655  CFz_Mnt = new su2double[nMarker];
15656  CMx_Mnt = new su2double[nMarker];
15657  CMy_Mnt = new su2double[nMarker];
15658  CMz_Mnt = new su2double[nMarker];
15659  CoPx_Mnt = new su2double[nMarker];
15660  CoPy_Mnt = new su2double[nMarker];
15661  CoPz_Mnt = new su2double[nMarker];
15662 
15663  ForceViscous = new su2double[3];
15664  MomentViscous = new su2double[3];
15665  CD_Visc = new su2double[nMarker];
15666  CL_Visc = new su2double[nMarker];
15667  CSF_Visc = new su2double[nMarker];
15668  CEff_Visc = new su2double[nMarker];
15669  CFx_Visc = new su2double[nMarker];
15670  CFy_Visc = new su2double[nMarker];
15671  CFz_Visc = new su2double[nMarker];
15672  CMx_Visc = new su2double[nMarker];
15673  CMy_Visc = new su2double[nMarker];
15674  CMz_Visc = new su2double[nMarker];
15675  CoPx_Visc = new su2double[nMarker];
15676  CoPy_Visc = new su2double[nMarker];
15677  CoPz_Visc = new su2double[nMarker];
15678  Cmu = new su2double[nMarker];
15679 
15690  Surface_Cmu = new su2double[config->GetnMarker_Monitoring()];
15691 
15702 
15703  Surface_CL = new su2double[config->GetnMarker_Monitoring()];
15704  Surface_CD = new su2double[config->GetnMarker_Monitoring()];
15705  Surface_CSF = new su2double[config->GetnMarker_Monitoring()];
15706  Surface_CEff = new su2double[config->GetnMarker_Monitoring()];
15707  Surface_CFx = new su2double[config->GetnMarker_Monitoring()];
15708  Surface_CFy = new su2double[config->GetnMarker_Monitoring()];
15709  Surface_CFz = new su2double[config->GetnMarker_Monitoring()];
15710  Surface_CMx = new su2double[config->GetnMarker_Monitoring()];
15711  Surface_CMy = new su2double[config->GetnMarker_Monitoring()];
15712  Surface_CMz = new su2double[config->GetnMarker_Monitoring()];
15713 
15714  Surface_CL_Visc = new su2double[config->GetnMarker_Monitoring()];
15715  Surface_CD_Visc = new su2double[config->GetnMarker_Monitoring()];
15716  Surface_CSF_Visc = new su2double[config->GetnMarker_Monitoring()];
15717  Surface_CEff_Visc = new su2double[config->GetnMarker_Monitoring()];
15718  Surface_CFx_Visc = new su2double[config->GetnMarker_Monitoring()];
15719  Surface_CFy_Visc = new su2double[config->GetnMarker_Monitoring()];
15720  Surface_CFz_Visc = new su2double[config->GetnMarker_Monitoring()];
15721  Surface_CMx_Visc = new su2double[config->GetnMarker_Monitoring()];
15722  Surface_CMy_Visc = new su2double[config->GetnMarker_Monitoring()];
15723  Surface_CMz_Visc = new su2double[config->GetnMarker_Monitoring()];
15726 
15727  if(config->GetBuffet_Monitoring() || config->GetKind_ObjFunc() == BUFFET_SENSOR){
15728 
15729  Buffet_Metric = new su2double[nMarker];
15730  Surface_Buffet_Metric = new su2double[config->GetnMarker_Monitoring()];
15731 
15732  }
15733 
15734 
15735  /*--- Rotational coefficients ---*/
15736 
15737  CMerit_Inv = new su2double[nMarker];
15738  CT_Inv = new su2double[nMarker];
15739  CQ_Inv = new su2double[nMarker];
15740 
15741  CMerit_Mnt = new su2double[nMarker];
15742  CT_Mnt = new su2double[nMarker];
15743  CQ_Mnt = new su2double[nMarker];
15744 
15745  CMerit_Visc = new su2double[nMarker];
15746  CT_Visc = new su2double[nMarker];
15747  CQ_Visc = new su2double[nMarker];
15748 
15749  /*--- Heat based coefficients ---*/
15750 
15751  HF_Visc = new su2double[nMarker];
15752  MaxHF_Visc = new su2double[nMarker];
15753 
15754  /*--- Supersonic coefficients ---*/
15755 
15758 
15759  /*--- Engine simulation ---*/
15760 
15763  Inflow_Mach = new su2double[nMarker];
15764  Inflow_Area = new su2double[nMarker];
15765 
15770 
15771  /*--- Init total coefficients ---*/
15772 
15773  Total_CD = 0.0; Total_CL = 0.0; Total_CSF = 0.0;
15774  Total_CMx = 0.0; Total_CMy = 0.0; Total_CMz = 0.0;
15775  Total_CoPx = 0.0; Total_CoPy = 0.0; Total_CoPz = 0.0;
15776  Total_CEff = 0.0; Total_CEquivArea = 0.0; Total_CNearFieldOF = 0.0;
15777  Total_CFx = 0.0; Total_CFy = 0.0; Total_CFz = 0.0;
15778  Total_CT = 0.0; Total_CQ = 0.0; Total_CMerit = 0.0;
15779  Total_MaxHeat = 0.0; Total_Heat = 0.0; Total_ComboObj = 0.0;
15780  Total_CpDiff = 0.0; Total_HeatFluxDiff = 0.0;
15781  Total_NetThrust = 0.0; Total_CL_Prev = 0.0;
15782  Total_Power = 0.0; AoA_Prev = 0.0; Total_CD_Prev = 0.0;
15783  Total_CMx_Prev = 0.0; Total_CMy_Prev = 0.0; Total_CMz_Prev = 0.0;
15784  Total_AeroCD = 0.0; Total_SolidCD = 0.0; Total_IDR = 0.0;
15785  Total_IDC = 0.0;
15786  Total_Custom_ObjFunc = 0.0;
15787 
15788  /*--- Read farfield conditions from config ---*/
15789 
15793  Energy_Inf = config->GetEnergy_FreeStreamND();
15795  Viscosity_Inf = config->GetViscosity_FreeStreamND();
15796  Mach_Inf = config->GetMach();
15797  Prandtl_Lam = config->GetPrandtl_Lam();
15798  Prandtl_Turb = config->GetPrandtl_Turb();
15799  Tke_Inf = config->GetTke_FreeStreamND();
15800 
15801  /*--- Initialize the secondary values for direct derivative approxiations ---*/
15802 
15803  switch(direct_diff) {
15804  case NO_DERIVATIVE:
15805  break;
15806  case D_DENSITY:
15808  break;
15809  case D_PRESSURE:
15811  break;
15812  case D_TEMPERATURE:
15814  break;
15815  case D_VISCOSITY:
15816  SU2_TYPE::SetDerivative(Viscosity_Inf, 1.0);
15817  break;
15818  case D_MACH: case D_AOA:
15819  case D_SIDESLIP: case D_REYNOLDS:
15820  case D_TURB2LAM: case D_DESIGN:
15821  /*--- Already done in postprocessing of config ---*/
15822  break;
15823  default:
15824  break;
15825  }
15826 
15827  /*--- Initialize fan face pressure, fan face mach number, and mass flow rate ---*/
15828 
15829  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15830  Inflow_MassFlow[iMarker] = 0.0;
15831  Inflow_Mach[iMarker] = Mach_Inf;
15832  Inflow_Pressure[iMarker] = Pressure_Inf;
15833  Inflow_Area[iMarker] = 0.0;
15834 
15835  Exhaust_MassFlow[iMarker] = 0.0;
15837  Exhaust_Pressure[iMarker] = Pressure_Inf;
15838  Exhaust_Area[iMarker] = 0.0;
15839 
15840  }
15841  /*--- Initializate quantities for SlidingMesh Interface ---*/
15842 
15843  SlidingState = new su2double*** [nMarker];
15844  SlidingStateNodes = new int* [nMarker];
15845 
15846  for (iMarker = 0; iMarker < nMarker; iMarker++){
15847 
15848  SlidingState[iMarker] = NULL;
15849  SlidingStateNodes[iMarker] = NULL;
15850 
15851  if (config->GetMarker_All_KindBC(iMarker) == FLUID_INTERFACE){
15852 
15853  SlidingState[iMarker] = new su2double**[geometry->GetnVertex(iMarker)];
15854  SlidingStateNodes[iMarker] = new int [geometry->GetnVertex(iMarker)];
15855 
15856  for (iPoint = 0; iPoint < geometry->GetnVertex(iMarker); iPoint++){
15857  SlidingState[iMarker][iPoint] = new su2double*[nPrimVar+1];
15858 
15859  SlidingStateNodes[iMarker][iPoint] = 0;
15860  for (iVar = 0; iVar < nPrimVar+1; iVar++)
15861  SlidingState[iMarker][iPoint][iVar] = NULL;
15862  }
15863 
15864  }
15865  }
15866 
15867  /*--- Initialize the solution to the far-field state everywhere. ---*/
15868 
15869  for (iPoint = 0; iPoint < nPoint; iPoint++)
15870  node[iPoint] = new CNSVariable(Density_Inf, Velocity_Inf, Energy_Inf, nDim, nVar, config);
15871 
15872  /*--- Check that the initial solution is physical, report any non-physical nodes ---*/
15873 
15874  counter_local = 0;
15875 
15876  for (iPoint = 0; iPoint < nPoint; iPoint++) {
15877 
15878  Density = node[iPoint]->GetSolution(0);
15879 
15880  Velocity2 = 0.0;
15881  for (iDim = 0; iDim < nDim; iDim++)
15882  Velocity2 += (node[iPoint]->GetSolution(iDim+1)/Density)*(node[iPoint]->GetSolution(iDim+1)/Density);
15883 
15884  StaticEnergy= node[iPoint]->GetSolution(nDim+1)/Density - 0.5*Velocity2;
15885 
15886  FluidModel->SetTDState_rhoe(Density, StaticEnergy);
15887  Pressure= FluidModel->GetPressure();
15888  Temperature= FluidModel->GetTemperature();
15889 
15890  /*--- Use the values at the infinity ---*/
15891 
15892  if ((Pressure < 0.0) || (Density < 0.0) || (Temperature < 0.0)) {
15893  Solution[0] = Density_Inf;
15894  for (iDim = 0; iDim < nDim; iDim++)
15895  Solution[iDim+1] = Velocity_Inf[iDim]*Density_Inf;
15897  node[iPoint]->SetSolution(Solution);
15898  node[iPoint]->SetSolution_Old(Solution);
15899  counter_local++;
15900  }
15901 
15902  }
15903 
15904  /*--- Initialize transpiration boundary velocity if necessary ---*/
15905 
15906  if(transp) SetTranspiration(geometry, config);
15907 
15908  /*--- Warning message about non-physical points ---*/
15909 
15910  if (config->GetConsole_Output_Verb() == VERB_HIGH) {
15911 #ifdef HAVE_MPI
15912  SU2_MPI::Reduce(&counter_local, &counter_global, 1, MPI_UNSIGNED_LONG, MPI_SUM, MASTER_NODE, MPI_COMM_WORLD);
15913 #else
15914  counter_global = counter_local;
15915 #endif
15916  if ((rank == MASTER_NODE) && (counter_global != 0))
15917  cout << "Warning. The original solution contains "<< counter_global << " points that are not physical." << endl;
15918  }
15919 
15920  /*--- Initialize the BGS residuals in FSI problems. ---*/
15921  if (fsi){
15922  Residual_BGS = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_RMS[iVar] = 0.0;
15923  Residual_Max_BGS = new su2double[nVar]; for (iVar = 0; iVar < nVar; iVar++) Residual_Max_BGS[iVar] = 0.0;
15924 
15925  /*--- Define some structures for locating max residuals ---*/
15926 
15927  Point_Max_BGS = new unsigned long[nVar]; for (iVar = 0; iVar < nVar; iVar++) Point_Max_BGS[iVar] = 0;
15929  for (iVar = 0; iVar < nVar; iVar++) {
15930  Point_Max_Coord_BGS[iVar] = new su2double[nDim];
15931  for (iDim = 0; iDim < nDim; iDim++) Point_Max_Coord_BGS[iVar][iDim] = 0.0;
15932  }
15933  }
15934 
15935  /*--- Define solver parameters needed for execution of destructor ---*/
15936 
15937  if (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) space_centered = true;
15938  else space_centered = false;
15939 
15940  if (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT) euler_implicit = true;
15941  else euler_implicit = false;
15942 
15944  else least_squares = false;
15945 
15946  /*--- Perform the MPI communication of the solution ---*/
15947 
15948  Set_MPI_Solution(geometry, config);
15949 
15950 }
15951 
15953 
15954  unsigned short iMarker, iDim;
15955 
15956  unsigned long iVertex;
15957 
15958  if (CD_Visc != NULL) delete [] CD_Visc;
15959  if (CL_Visc != NULL) delete [] CL_Visc;
15960  if (CSF_Visc != NULL) delete [] CSF_Visc;
15961  if (CFx_Visc != NULL) delete [] CFx_Visc;
15962  if (CFy_Visc != NULL) delete [] CFy_Visc;
15963  if (CFz_Visc != NULL) delete [] CFz_Visc;
15964  if (CMx_Visc != NULL) delete [] CMx_Visc;
15965  if (CMy_Visc != NULL) delete [] CMy_Visc;
15966  if (CMz_Visc != NULL) delete [] CMz_Visc;
15967  if (CoPx_Visc != NULL) delete [] CoPx_Visc;
15968  if (CoPy_Visc != NULL) delete [] CoPy_Visc;
15969  if (CoPz_Visc != NULL) delete [] CoPz_Visc;
15970  if (CEff_Visc != NULL) delete [] CEff_Visc;
15971  if (CMerit_Visc != NULL) delete [] CMerit_Visc;
15972  if (Buffet_Metric != NULL) delete [] Buffet_Metric;
15973  if (CT_Visc != NULL) delete [] CT_Visc;
15974  if (CQ_Visc != NULL) delete [] CQ_Visc;
15975  if (HF_Visc != NULL) delete [] HF_Visc;
15976  if (MaxHF_Visc != NULL) delete [] MaxHF_Visc;
15977  if (ForceViscous != NULL) delete [] ForceViscous;
15978  if (MomentViscous != NULL) delete [] MomentViscous;
15979 
15980  if (Surface_CL_Visc != NULL) delete [] Surface_CL_Visc;
15981  if (Surface_CD_Visc != NULL) delete [] Surface_CD_Visc;
15982  if (Surface_CSF_Visc != NULL) delete [] Surface_CSF_Visc;
15983  if (Surface_CEff_Visc != NULL) delete [] Surface_CEff_Visc;
15984  if (Surface_CFx_Visc != NULL) delete [] Surface_CFx_Visc;
15985  if (Surface_CFy_Visc != NULL) delete [] Surface_CFy_Visc;
15986  if (Surface_CFz_Visc != NULL) delete [] Surface_CFz_Visc;
15987  if (Surface_CMx_Visc != NULL) delete [] Surface_CMx_Visc;
15988  if (Surface_CMy_Visc != NULL) delete [] Surface_CMy_Visc;
15989  if (Surface_CMz_Visc != NULL) delete [] Surface_CMz_Visc;
15990  if (Surface_HF_Visc != NULL) delete [] Surface_HF_Visc;
15991  if (Surface_MaxHF_Visc != NULL) delete [] Surface_MaxHF_Visc;
15992  if (Surface_Buffet_Metric != NULL) delete [] Surface_Buffet_Metric;
15993 
15994  if (CSkinFriction != NULL) {
15995  for (iMarker = 0; iMarker < nMarker; iMarker++) {
15996  for (iDim = 0; iDim < nDim; iDim++) {
15997  delete [] CSkinFriction[iMarker][iDim];
15998  }
15999  delete [] CSkinFriction[iMarker];
16000  }
16001  delete [] CSkinFriction;
16002  }
16003 
16004  if (HeatConjugateVar != NULL) {
16005  for (iMarker = 0; iMarker < nMarker; iMarker++) {
16006  for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
16007  delete [] HeatConjugateVar[iMarker][iVertex];
16008  }
16009  delete [] HeatConjugateVar[iMarker];
16010  }
16011  delete [] HeatConjugateVar;
16012  }
16013 
16014  if (Buffet_Sensor != NULL) {
16015  for (iMarker = 0; iMarker < nMarker; iMarker++){
16016  delete [] Buffet_Sensor[iMarker];
16017  }
16018  delete [] Buffet_Sensor;
16019  }
16020 
16021 }
16022 
16023 void CNSSolver::Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output) {
16024 
16025  unsigned long iPoint, ErrorCounter = 0;
16026  su2double StrainMag = 0.0, Omega = 0.0, *Vorticity;
16027 
16028  unsigned long ExtIter = config->GetExtIter();
16029  bool cont_adjoint = config->GetContinuous_Adjoint();
16030  bool disc_adjoint = config->GetDiscrete_Adjoint();
16031  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
16032  bool center = (config->GetKind_ConvNumScheme_Flow() == SPACE_CENTERED) || (cont_adjoint && config->GetKind_ConvNumScheme_AdjFlow() == SPACE_CENTERED);
16033  bool center_jst = center && config->GetKind_Centered_Flow() == JST;
16034  bool limiter_flow = ((config->GetKind_SlopeLimit_Flow() != NO_LIMITER) && (ExtIter <= config->GetLimiterIter()) && !(disc_adjoint && config->GetFrozen_Limiter_Disc()));
16035  bool limiter_turb = ((config->GetKind_SlopeLimit_Turb() != NO_LIMITER) && (ExtIter <= config->GetLimiterIter()) && !(disc_adjoint && config->GetFrozen_Limiter_Disc()));
16036  bool limiter_adjflow = (cont_adjoint && (config->GetKind_SlopeLimit_AdjFlow() != NO_LIMITER) && (ExtIter <= config->GetLimiterIter()));
16037  bool fixed_cl = config->GetFixed_CL_Mode();
16038  bool engine = ((config->GetnMarker_EngineInflow() != 0) || (config->GetnMarker_EngineExhaust() != 0));
16039  bool actuator_disk = ((config->GetnMarker_ActDiskInlet() != 0) || (config->GetnMarker_ActDiskOutlet() != 0));
16040  bool nearfield = (config->GetnMarker_NearFieldBound() != 0);
16041  bool interface = (config->GetnMarker_InterfaceBound() != 0);
16042  bool van_albada = config->GetKind_SlopeLimit_Flow() == VAN_ALBADA_EDGE;
16043  unsigned short kind_row_dissipation = config->GetKind_RoeLowDiss();
16044  bool roe_low_dissipation = (kind_row_dissipation != NO_ROELOWDISS) && (config->GetKind_Upwind_Flow() == ROE);
16045  bool wall_functions = config->GetWall_Functions();
16046 
16047  /*--- Update the angle of attack at the far-field for fixed CL calculations (only direct problem). ---*/
16048 
16049  if ((fixed_cl) && (!disc_adjoint) && (!cont_adjoint)) { SetFarfield_AoA(geometry, solver_container, config, iMesh, Output); }
16050 
16051  /*--- Set the primitive variables ---*/
16052 
16053  ErrorCounter = SetPrimitive_Variables(solver_container, config, Output);
16054 
16055  /*--- Compute the engine properties ---*/
16056 
16057  if (engine) { GetPower_Properties(geometry, config, iMesh, Output); }
16058 
16059  /*--- Compute the actuator disk properties and distortion levels ---*/
16060 
16061  if (actuator_disk) {
16062  Set_MPI_ActDisk(solver_container, geometry, config);
16063  SetActDisk_BCThrust(geometry, solver_container, config, iMesh, Output);
16064  }
16065 
16066  /*--- Compute Interface MPI ---*/
16067 
16068  if (interface) { Set_MPI_Interface(geometry, config); }
16069 
16070  /*--- Compute NearField MPI ---*/
16071 
16072  if (nearfield) { Set_MPI_Nearfield(geometry, config); }
16073 
16074  /*--- Artificial dissipation ---*/
16075 
16076  if (center && !Output) {
16077  SetMax_Eigenvalue(geometry, config);
16078  if ((center_jst) && (iMesh == MESH_0)) {
16079  SetCentered_Dissipation_Sensor(geometry, config);
16080  SetUndivided_Laplacian(geometry, config);
16081  }
16082  }
16083 
16084  /*--- Roe Low Dissipation Sensor ---*/
16085 
16086  if (roe_low_dissipation){
16087  SetRoe_Dissipation(geometry, config);
16088  if (kind_row_dissipation == FD_DUCROS || kind_row_dissipation == NTS_DUCROS){
16089  SetUpwind_Ducros_Sensor(geometry, config);
16090  }
16091  }
16092 
16093  /*--- Compute gradient of the primitive variables ---*/
16094 
16095  if (config->GetKind_Gradient_Method() == GREEN_GAUSS) {
16096  SetPrimitive_Gradient_GG(geometry, config);
16097  }
16099  SetPrimitive_Gradient_LS(geometry, config);
16100  }
16101 
16102  /*--- Compute the limiter in case we need it in the turbulence model
16103  or to limit the viscous terms (check this logic with JST and 2nd order turbulence model) ---*/
16104 
16105  if ((iMesh == MESH_0) && (limiter_flow || limiter_turb || limiter_adjflow)
16106  && !Output && !van_albada) { SetPrimitive_Limiter(geometry, config); }
16107 
16108  /*--- Evaluate the vorticity and strain rate magnitude ---*/
16109 
16110  StrainMag_Max = 0.0; Omega_Max = 0.0;
16111  for (iPoint = 0; iPoint < nPoint; iPoint++) {
16112 
16113  solver_container[FLOW_SOL]->node[iPoint]->SetVorticity();
16114  solver_container[FLOW_SOL]->node[iPoint]->SetStrainMag();
16115 
16116  StrainMag = solver_container[FLOW_SOL]->node[iPoint]->GetStrainMag();
16117  Vorticity = solver_container[FLOW_SOL]->node[iPoint]->GetVorticity();
16118  Omega = sqrt(Vorticity[0]*Vorticity[0]+ Vorticity[1]*Vorticity[1]+ Vorticity[2]*Vorticity[2]);
16119 
16120  StrainMag_Max = max(StrainMag_Max, StrainMag);
16121  Omega_Max = max(Omega_Max, Omega);
16122 
16123  }
16124 
16125  /*--- Compute the TauWall from the wall functions ---*/
16126 
16127  if (wall_functions)
16128  SetTauWall_WF(geometry, solver_container, config);
16129 
16130  /*--- Initialize the Jacobian matrices ---*/
16131 
16132  if (implicit && !config->GetDiscrete_Adjoint()) Jacobian.SetValZero();
16133 
16134  /*--- Error message ---*/
16135 
16136  if (config->GetConsole_Output_Verb() == VERB_HIGH) {
16137 
16138 #ifdef HAVE_MPI
16139  unsigned long MyErrorCounter = ErrorCounter; ErrorCounter = 0;
16140  su2double MyOmega_Max = Omega_Max; Omega_Max = 0.0;
16141  su2double MyStrainMag_Max = StrainMag_Max; StrainMag_Max = 0.0;
16142 
16143  SU2_MPI::Allreduce(&MyErrorCounter, &ErrorCounter, 1, MPI_UNSIGNED_LONG, MPI_SUM, MPI_COMM_WORLD);
16144  SU2_MPI::Allreduce(&MyStrainMag_Max, &StrainMag_Max, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
16145  SU2_MPI::Allreduce(&MyOmega_Max, &Omega_Max, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
16146 #endif
16147 
16148  if (iMesh == MESH_0) {
16149  config->SetNonphysical_Points(ErrorCounter);
16150  solver_container[FLOW_SOL]->SetStrainMag_Max(StrainMag_Max);
16151  solver_container[FLOW_SOL]->SetOmega_Max(Omega_Max);
16152  }
16153 
16154  }
16155 
16156 }
16157 
16158 unsigned long CNSSolver::SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output) {
16159 
16160  unsigned long iPoint, ErrorCounter = 0;
16161  su2double eddy_visc = 0.0, turb_ke = 0.0, DES_LengthScale = 0.0;
16162  unsigned short turb_model = config->GetKind_Turb_Model();
16163  bool RightSol = true;
16164 
16165  bool tkeNeeded = (turb_model == SST);
16166 
16167  for (iPoint = 0; iPoint < nPoint; iPoint ++) {
16168 
16169  /*--- Retrieve the value of the kinetic energy (if need it) ---*/
16170 
16171  if (turb_model != NONE) {
16172  eddy_visc = solver_container[TURB_SOL]->node[iPoint]->GetmuT();
16173  if (tkeNeeded) turb_ke = solver_container[TURB_SOL]->node[iPoint]->GetSolution(0);
16174 
16175  if (config->GetKind_HybridRANSLES() != NO_HYBRIDRANSLES){
16176  DES_LengthScale = solver_container[TURB_SOL]->node[iPoint]->GetDES_LengthScale();
16177  }
16178  }
16179 
16180  /*--- Initialize the non-physical points vector ---*/
16181 
16182  node[iPoint]->SetNon_Physical(false);
16183 
16184  /*--- Compressible flow, primitive variables nDim+5, (T, vx, vy, vz, P, rho, h, c, lamMu, eddyMu, ThCond, Cp) ---*/
16185 
16186  RightSol = node[iPoint]->SetPrimVar(eddy_visc, turb_ke, FluidModel);
16187  node[iPoint]->SetSecondaryVar(FluidModel);
16188 
16189  if (!RightSol) { node[iPoint]->SetNon_Physical(true); ErrorCounter++; }
16190 
16191  /*--- Set the DES length scale ---*/
16192 
16193  node[iPoint]->SetDES_LengthScale(DES_LengthScale);
16194 
16195  /*--- Initialize the convective, source and viscous residual vector ---*/
16196 
16197  if (!Output) LinSysRes.SetBlock_Zero(iPoint);
16198 
16199  }
16200 
16201  return ErrorCounter;
16202 }
16203 
16204 void CNSSolver::SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned long Iteration) {
16205 
16206  su2double *Normal, Area, Vol, Mean_SoundSpeed = 0.0, Mean_ProjVel = 0.0, Lambda, Local_Delta_Time, Local_Delta_Time_Visc,
16207  Global_Delta_Time = 1E6, Mean_LaminarVisc = 0.0, Mean_EddyVisc = 0.0, Mean_Density = 0.0, Lambda_1, Lambda_2, K_v = 0.25, Global_Delta_UnstTimeND;
16208  unsigned long iEdge, iVertex, iPoint = 0, jPoint = 0;
16209  unsigned short iDim, iMarker;
16210  su2double ProjVel, ProjVel_i, ProjVel_j;
16211 
16212  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
16213  bool grid_movement = config->GetGrid_Movement();
16214  bool dual_time = ((config->GetUnsteady_Simulation() == DT_STEPPING_1ST) ||
16215  (config->GetUnsteady_Simulation() == DT_STEPPING_2ND));
16216 
16217  Min_Delta_Time = 1.E6; Max_Delta_Time = 0.0;
16218 
16219  /*--- Set maximum inviscid eigenvalue to zero, and compute sound speed and viscosity ---*/
16220 
16221  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
16222  node[iPoint]->SetMax_Lambda_Inv(0.0);
16223  node[iPoint]->SetMax_Lambda_Visc(0.0);
16224  }
16225 
16226  /*--- Loop interior edges ---*/
16227 
16228  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
16229 
16230  /*--- Point identification, Normal vector and area ---*/
16231 
16232  iPoint = geometry->edge[iEdge]->GetNode(0);
16233  jPoint = geometry->edge[iEdge]->GetNode(1);
16234 
16235  Normal = geometry->edge[iEdge]->GetNormal();
16236  Area = 0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
16237 
16238  /*--- Mean Values ---*/
16239 
16240  Mean_ProjVel = 0.5 * (node[iPoint]->GetProjVel(Normal) + node[jPoint]->GetProjVel(Normal));
16241  Mean_SoundSpeed = 0.5 * (node[iPoint]->GetSoundSpeed() + node[jPoint]->GetSoundSpeed()) * Area;
16242 
16243  /*--- Adjustment for grid movement ---*/
16244 
16245  if (grid_movement) {
16246  su2double *GridVel_i = geometry->node[iPoint]->GetGridVel();
16247  su2double *GridVel_j = geometry->node[jPoint]->GetGridVel();
16248  ProjVel_i = 0.0; ProjVel_j =0.0;
16249  for (iDim = 0; iDim < nDim; iDim++) {
16250  ProjVel_i += GridVel_i[iDim]*Normal[iDim];
16251  ProjVel_j += GridVel_j[iDim]*Normal[iDim];
16252  }
16253  Mean_ProjVel -= 0.5 * (ProjVel_i + ProjVel_j) ;
16254  }
16255 
16256  /*--- Inviscid contribution ---*/
16257 
16258  Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed ;
16259  if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Inv(Lambda);
16260  if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddMax_Lambda_Inv(Lambda);
16261 
16262  /*--- Viscous contribution ---*/
16263 
16264  Mean_LaminarVisc = 0.5*(node[iPoint]->GetLaminarViscosity() + node[jPoint]->GetLaminarViscosity());
16265  Mean_EddyVisc = 0.5*(node[iPoint]->GetEddyViscosity() + node[jPoint]->GetEddyViscosity());
16266  Mean_Density = 0.5*(node[iPoint]->GetSolution(0) + node[jPoint]->GetSolution(0));
16267 
16268  Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc);
16269  //TODO (REAL_GAS) removing Gamma it cannot work with FLUIDPROP
16270  Lambda_2 = (1.0 + (Prandtl_Lam/Prandtl_Turb)*(Mean_EddyVisc/Mean_LaminarVisc))*(Gamma*Mean_LaminarVisc/Prandtl_Lam);
16271  Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density;
16272 
16273  if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Visc(Lambda);
16274  if (geometry->node[jPoint]->GetDomain()) node[jPoint]->AddMax_Lambda_Visc(Lambda);
16275 
16276  }
16277 
16278  /*--- Loop boundary edges ---*/
16279 
16280  for (iMarker = 0; iMarker < geometry->GetnMarker(); iMarker++) {
16281  if (config->GetMarker_All_KindBC(iMarker) != INTERNAL_BOUNDARY)
16282  for (iVertex = 0; iVertex < geometry->GetnVertex(iMarker); iVertex++) {
16283 
16284  /*--- Point identification, Normal vector and area ---*/
16285 
16286  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
16287  Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
16288  Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
16289 
16290  /*--- Mean Values ---*/
16291 
16292  Mean_ProjVel = node[iPoint]->GetProjVel(Normal);
16293  Mean_SoundSpeed = node[iPoint]->GetSoundSpeed() * Area;
16294 
16295  /*--- Adjustment for grid movement ---*/
16296 
16297  if (grid_movement) {
16298  su2double *GridVel = geometry->node[iPoint]->GetGridVel();
16299  ProjVel = 0.0;
16300  for (iDim = 0; iDim < nDim; iDim++)
16301  ProjVel += GridVel[iDim]*Normal[iDim];
16302  Mean_ProjVel -= ProjVel;
16303  }
16304 
16305  /*--- Inviscid contribution ---*/
16306 
16307  Lambda = fabs(Mean_ProjVel) + Mean_SoundSpeed;
16308  if (geometry->node[iPoint]->GetDomain()) {
16309  node[iPoint]->AddMax_Lambda_Inv(Lambda);
16310  }
16311 
16312  /*--- Viscous contribution ---*/
16313 
16314  Mean_LaminarVisc = node[iPoint]->GetLaminarViscosity();
16315  Mean_EddyVisc = node[iPoint]->GetEddyViscosity();
16316  Mean_Density = node[iPoint]->GetSolution(0);
16317 
16318  Lambda_1 = (4.0/3.0)*(Mean_LaminarVisc + Mean_EddyVisc);
16319  Lambda_2 = (1.0 + (Prandtl_Lam/Prandtl_Turb)*(Mean_EddyVisc/Mean_LaminarVisc))*(Gamma*Mean_LaminarVisc/Prandtl_Lam);
16320  Lambda = (Lambda_1 + Lambda_2)*Area*Area/Mean_Density;
16321 
16322  if (geometry->node[iPoint]->GetDomain()) node[iPoint]->AddMax_Lambda_Visc(Lambda);
16323 
16324  }
16325  }
16326 
16327  /*--- Each element uses their own speed, steady state simulation ---*/
16328 
16329 
16330  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
16331 
16332  Vol = geometry->node[iPoint]->GetVolume();
16333 
16334  if (Vol != 0.0) {
16335  Local_Delta_Time = config->GetCFL(iMesh)*Vol / node[iPoint]->GetMax_Lambda_Inv();
16336  Local_Delta_Time_Visc = config->GetCFL(iMesh)*K_v*Vol*Vol/ node[iPoint]->GetMax_Lambda_Visc();
16337  Local_Delta_Time = min(Local_Delta_Time, Local_Delta_Time_Visc);
16338  Global_Delta_Time = min(Global_Delta_Time, Local_Delta_Time);
16339  Min_Delta_Time = min(Min_Delta_Time, Local_Delta_Time);
16340  Max_Delta_Time = max(Max_Delta_Time, Local_Delta_Time);
16341  if (Local_Delta_Time > config->GetMax_DeltaTime())
16342  Local_Delta_Time = config->GetMax_DeltaTime();
16343  node[iPoint]->SetDelta_Time(Local_Delta_Time);
16344  }
16345  else {
16346  node[iPoint]->SetDelta_Time(0.0);
16347  }
16348 
16349  }
16350 
16351 
16352  /*--- Compute the max and the min dt (in parallel) ---*/
16353  if (config->GetConsole_Output_Verb() == VERB_HIGH) {
16354 #ifdef HAVE_MPI
16355  su2double rbuf_time, sbuf_time;
16356  sbuf_time = Min_Delta_Time;
16357  SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD);
16359  Min_Delta_Time = rbuf_time;
16360 
16361  sbuf_time = Max_Delta_Time;
16362  SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MAX, MASTER_NODE, MPI_COMM_WORLD);
16364  Max_Delta_Time = rbuf_time;
16365 #endif
16366  }
16367 
16368  /*--- For exact time solution use the minimum delta time of the whole mesh ---*/
16369  if (config->GetUnsteady_Simulation() == TIME_STEPPING) {
16370 #ifdef HAVE_MPI
16371  su2double rbuf_time, sbuf_time;
16372  sbuf_time = Global_Delta_Time;
16373  SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD);
16375  Global_Delta_Time = rbuf_time;
16376 #endif
16377  for (iPoint = 0; iPoint < nPointDomain; iPoint++)
16378  node[iPoint]->SetDelta_Time(Global_Delta_Time);
16379  }
16380 
16381  /*--- Recompute the unsteady time step for the dual time strategy
16382  if the unsteady CFL is diferent from 0 ---*/
16383  if ((dual_time) && (Iteration == 0) && (config->GetUnst_CFL() != 0.0) && (iMesh == MESH_0)) {
16384  Global_Delta_UnstTimeND = config->GetUnst_CFL()*Global_Delta_Time/config->GetCFL(iMesh);
16385 
16386 #ifdef HAVE_MPI
16387  su2double rbuf_time, sbuf_time;
16388  sbuf_time = Global_Delta_UnstTimeND;
16389  SU2_MPI::Reduce(&sbuf_time, &rbuf_time, 1, MPI_DOUBLE, MPI_MIN, MASTER_NODE, MPI_COMM_WORLD);
16391  Global_Delta_UnstTimeND = rbuf_time;
16392 #endif
16393  config->SetDelta_UnstTimeND(Global_Delta_UnstTimeND);
16394  }
16395 
16396  /*--- The pseudo local time (explicit integration) cannot be greater than the physical time ---*/
16397  if (dual_time)
16398  for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
16399  if (!implicit) {
16400  Local_Delta_Time = min((2.0/3.0)*config->GetDelta_UnstTimeND(), node[iPoint]->GetDelta_Time());
16401  node[iPoint]->SetDelta_Time(Local_Delta_Time);
16402  }
16403  }
16404 
16405 }
16406 
16407 void CNSSolver::Viscous_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics,
16408  CConfig *config, unsigned short iMesh, unsigned short iRKStep) {
16409 
16410  unsigned long iPoint, jPoint, iEdge;
16411 
16412  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
16413 
16414  for (iEdge = 0; iEdge < geometry->GetnEdge(); iEdge++) {
16415 
16416  /*--- Points, coordinates and normal vector in edge ---*/
16417 
16418  iPoint = geometry->edge[iEdge]->GetNode(0);
16419  jPoint = geometry->edge[iEdge]->GetNode(1);
16420  numerics->SetCoord(geometry->node[iPoint]->GetCoord(), geometry->node[jPoint]->GetCoord());
16421  numerics->SetNormal(geometry->edge[iEdge]->GetNormal());
16422 
16423  /*--- Primitive and secondary variables ---*/
16424 
16425  numerics->SetPrimitive(node[iPoint]->GetPrimitive(), node[jPoint]->GetPrimitive());
16426  numerics->SetSecondary(node[iPoint]->GetSecondary(), node[jPoint]->GetSecondary());
16427 
16428  /*--- Gradient and limiters ---*/
16429 
16430  numerics->SetPrimVarGradient(node[iPoint]->GetGradient_Primitive(), node[jPoint]->GetGradient_Primitive());
16431 
16432  /*--- Turbulent kinetic energy ---*/
16433 
16434  if (config->GetKind_Turb_Model() == SST)
16435  numerics->SetTurbKineticEnergy(solver_container[TURB_SOL]->node[iPoint]->GetSolution(0),
16436  solver_container[TURB_SOL]->node[jPoint]->GetSolution(0));
16437 
16438  /*--- Wall shear stress values (wall functions) ---*/
16439 
16440  numerics->SetTauWall(node[iPoint]->GetTauWall(), node[iPoint]->GetTauWall());
16441 
16442  /*--- Compute and update residual ---*/
16443 
16444  numerics->ComputeResidual(Res_Visc, Jacobian_i, Jacobian_j, config);
16445 
16446  LinSysRes.SubtractBlock(iPoint, Res_Visc);
16447  LinSysRes.AddBlock(jPoint, Res_Visc);
16448 
16449  /*--- Implicit part ---*/
16450 
16451  if (implicit) {
16452  Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
16453  Jacobian.SubtractBlock(iPoint, jPoint, Jacobian_j);
16454  Jacobian.AddBlock(jPoint, iPoint, Jacobian_i);
16455  Jacobian.AddBlock(jPoint, jPoint, Jacobian_j);
16456  }
16457 
16458  }
16459 
16460 }
16461 
16463 
16464  unsigned long iVertex, iPoint, iPointNormal;
16465  unsigned short Boundary, Monitoring, iMarker, iMarker_Monitoring, iDim, jDim;
16466  su2double Viscosity = 0.0, div_vel, *Normal, MomentDist[3] = {0.0, 0.0, 0.0}, WallDist[3] = {0.0, 0.0, 0.0},
16467  *Coord, *Coord_Normal, Area, WallShearStress, TauNormal, factor, RefTemp, RefVel2,
16468  RefDensity, GradTemperature, Density = 0.0, WallDistMod, FrictionVel,
16469  Mach2Vel, Mach_Motion, UnitNormal[3] = {0.0, 0.0, 0.0}, TauElem[3] = {0.0, 0.0, 0.0}, TauTangent[3] = {0.0, 0.0, 0.0},
16470  Tau[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.0, 0.0}}, Force[3] = {0.0, 0.0, 0.0}, Cp, thermal_conductivity, MaxNorm = 8.0,
16471  Grad_Vel[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.0, 0.0}}, Grad_Temp[3] = {0.0, 0.0, 0.0},
16472  delta[3][3] = {{1.0, 0.0, 0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}};
16473  su2double MomentX_Force[3] = {0.0,0.0,0.0}, MomentY_Force[3] = {0.0,0.0,0.0}, MomentZ_Force[3] = {0.0,0.0,0.0};
16474  su2double AxiFactor;
16475 
16476 #ifdef HAVE_MPI
16477  su2double MyAllBound_CD_Visc, MyAllBound_CL_Visc, MyAllBound_CSF_Visc, MyAllBound_CMx_Visc, MyAllBound_CMy_Visc, MyAllBound_CMz_Visc, MyAllBound_CoPx_Visc, MyAllBound_CoPy_Visc, MyAllBound_CoPz_Visc, MyAllBound_CFx_Visc, MyAllBound_CFy_Visc, MyAllBound_CFz_Visc, MyAllBound_CT_Visc, MyAllBound_CQ_Visc, MyAllBound_HF_Visc, MyAllBound_MaxHF_Visc, *MySurface_CL_Visc = NULL, *MySurface_CD_Visc = NULL, *MySurface_CSF_Visc = NULL, *MySurface_CEff_Visc = NULL, *MySurface_CFx_Visc = NULL, *MySurface_CFy_Visc = NULL, *MySurface_CFz_Visc = NULL, *MySurface_CMx_Visc = NULL, *MySurface_CMy_Visc = NULL, *MySurface_CMz_Visc = NULL, *MySurface_HF_Visc = NULL, *MySurface_MaxHF_Visc;
16478 #endif
16479 
16480  string Marker_Tag, Monitoring_Tag;
16481 
16482  su2double Alpha = config->GetAoA()*PI_NUMBER/180.0;
16483  su2double Beta = config->GetAoS()*PI_NUMBER/180.0;
16484  su2double RefArea = config->GetRefArea();
16485  su2double RefLength = config->GetRefLength();
16486  su2double Gas_Constant = config->GetGas_ConstantND();
16487  su2double *Origin = NULL;
16488 
16489  if (config->GetnMarker_Monitoring() != 0) { Origin = config->GetRefOriginMoment(0); }
16490 
16491  bool grid_movement = config->GetGrid_Movement();
16492  su2double Prandtl_Lam = config->GetPrandtl_Lam();
16493  bool QCR = config->GetQCR();
16494  bool axisymmetric = config->GetAxisymmetric();
16495 
16496  /*--- Evaluate reference values for non-dimensionalization.
16497  For dynamic meshes, use the motion Mach number as a reference value
16498  for computing the force coefficients. Otherwise, use the freestream values,
16499  which is the standard convention. ---*/
16500 
16501  RefTemp = Temperature_Inf;
16502  RefDensity = Density_Inf;
16503  if (grid_movement) {
16504  Mach2Vel = sqrt(Gamma*Gas_Constant*RefTemp);
16505  Mach_Motion = config->GetMach_Motion();
16506  RefVel2 = (Mach_Motion*Mach2Vel)*(Mach_Motion*Mach2Vel);
16507  } else {
16508  RefVel2 = 0.0;
16509  for (iDim = 0; iDim < nDim; iDim++)
16510  RefVel2 += Velocity_Inf[iDim]*Velocity_Inf[iDim];
16511  }
16512 
16513  factor = 1.0 / (0.5*RefDensity*RefArea*RefVel2);
16514 
16515  /*--- Variables initialization ---*/
16516 
16517  AllBound_CD_Visc = 0.0; AllBound_CL_Visc = 0.0; AllBound_CSF_Visc = 0.0;
16518  AllBound_CFx_Visc = 0.0; AllBound_CFy_Visc = 0.0; AllBound_CFz_Visc = 0.0;
16519  AllBound_CMx_Visc = 0.0; AllBound_CMy_Visc = 0.0; AllBound_CMz_Visc = 0.0;
16520  AllBound_CoPx_Visc = 0.0; AllBound_CoPy_Visc = 0.0; AllBound_CoPz_Visc = 0.0;
16521  AllBound_CT_Visc = 0.0; AllBound_CQ_Visc = 0.0; AllBound_CMerit_Visc = 0.0;
16522  AllBound_HF_Visc = 0.0; AllBound_MaxHF_Visc = 0.0; AllBound_CEff_Visc = 0.0;
16523 
16524  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
16525  Surface_CL_Visc[iMarker_Monitoring] = 0.0; Surface_CD_Visc[iMarker_Monitoring] = 0.0;
16526  Surface_CSF_Visc[iMarker_Monitoring] = 0.0; Surface_CEff_Visc[iMarker_Monitoring] = 0.0;
16527  Surface_CFx_Visc[iMarker_Monitoring] = 0.0; Surface_CFy_Visc[iMarker_Monitoring] = 0.0;
16528  Surface_CFz_Visc[iMarker_Monitoring] = 0.0; Surface_CMx_Visc[iMarker_Monitoring] = 0.0;
16529  Surface_CMy_Visc[iMarker_Monitoring] = 0.0; Surface_CMz_Visc[iMarker_Monitoring] = 0.0;
16530  Surface_HF_Visc[iMarker_Monitoring] = 0.0; Surface_MaxHF_Visc[iMarker_Monitoring] = 0.0;
16531  }
16532 
16533  /*--- Loop over the Navier-Stokes markers ---*/
16534 
16535  for (iMarker = 0; iMarker < nMarker; iMarker++) {
16536 
16537  Boundary = config->GetMarker_All_KindBC(iMarker);
16538  Monitoring = config->GetMarker_All_Monitoring(iMarker);
16539 
16540  /*--- Obtain the origin for the moment computation for a particular marker ---*/
16541 
16542  if (Monitoring == YES) {
16543  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
16544  Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
16545  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
16546  if (Marker_Tag == Monitoring_Tag)
16547  Origin = config->GetRefOriginMoment(iMarker_Monitoring);
16548  }
16549  }
16550 
16551  if ((Boundary == HEAT_FLUX) || (Boundary == ISOTHERMAL) || (Boundary == TRANSPIRATION)) {
16552 
16553  /*--- Forces initialization at each Marker ---*/
16554 
16555  CD_Visc[iMarker] = 0.0; CL_Visc[iMarker] = 0.0; CSF_Visc[iMarker] = 0.0;
16556  CFx_Visc[iMarker] = 0.0; CFy_Visc[iMarker] = 0.0; CFz_Visc[iMarker] = 0.0;
16557  CMx_Visc[iMarker] = 0.0; CMy_Visc[iMarker] = 0.0; CMz_Visc[iMarker] = 0.0;
16558  CoPx_Visc[iMarker] = 0.0; CoPy_Visc[iMarker] = 0.0; CoPz_Visc[iMarker] = 0.0;
16559  CT_Visc[iMarker] = 0.0; CQ_Visc[iMarker] = 0.0; CMerit_Visc[iMarker] = 0.0;
16560  HF_Visc[iMarker] = 0.0; MaxHF_Visc[iMarker] = 0.0; CEff_Visc[iMarker] = 0.0;
16561 
16562  for (iDim = 0; iDim < nDim; iDim++) ForceViscous[iDim] = 0.0;
16563  MomentViscous[0] = 0.0; MomentViscous[1] = 0.0; MomentViscous[2] = 0.0;
16564  MomentX_Force[0] = 0.0; MomentX_Force[1] = 0.0; MomentX_Force[2] = 0.0;
16565  MomentY_Force[0] = 0.0; MomentY_Force[1] = 0.0; MomentY_Force[2] = 0.0;
16566  MomentZ_Force[0] = 0.0; MomentZ_Force[1] = 0.0; MomentZ_Force[2] = 0.0;
16567 
16568  /*--- Loop over the vertices to compute the forces ---*/
16569 
16570  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
16571 
16572  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
16573  iPointNormal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
16574 
16575  Coord = geometry->node[iPoint]->GetCoord();
16576  Coord_Normal = geometry->node[iPointNormal]->GetCoord();
16577 
16578  Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
16579 
16580  for (iDim = 0; iDim < nDim; iDim++) {
16581  for (jDim = 0 ; jDim < nDim; jDim++) {
16582  Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim);
16583  }
16584  Grad_Temp[iDim] = node[iPoint]->GetGradient_Primitive(0, iDim);
16585  }
16586 
16587  Viscosity = node[iPoint]->GetLaminarViscosity();
16588  Density = node[iPoint]->GetDensity();
16589 
16590  Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
16591 
16592 
16593  for (iDim = 0; iDim < nDim; iDim++) {
16594  UnitNormal[iDim] = Normal[iDim]/Area;
16595  }
16596 
16597  /*--- Evaluate Tau ---*/
16598 
16599  div_vel = 0.0; for (iDim = 0; iDim < nDim; iDim++) div_vel += Grad_Vel[iDim][iDim];
16600 
16601  for (iDim = 0; iDim < nDim; iDim++) {
16602  for (jDim = 0 ; jDim < nDim; jDim++) {
16603  Tau[iDim][jDim] = Viscosity*(Grad_Vel[jDim][iDim] + Grad_Vel[iDim][jDim]) - TWO3*Viscosity*div_vel*delta[iDim][jDim];
16604  }
16605  }
16606 
16607  /*--- If necessary evaluate the QCR contribution to Tau ---*/
16608 
16609  if (QCR){
16610  su2double den_aux, c_cr1=0.3, O_ik, O_jk;
16611  unsigned short kDim;
16612 
16613  /*--- Denominator Antisymmetric normalized rotation tensor ---*/
16614 
16615  den_aux = 0.0;
16616  for (iDim = 0 ; iDim < nDim; iDim++)
16617  for (jDim = 0 ; jDim < nDim; jDim++)
16618  den_aux += Grad_Vel[iDim][jDim] * Grad_Vel[iDim][jDim];
16619  den_aux = sqrt(max(den_aux,1E-10));
16620 
16621  /*--- Adding the QCR contribution ---*/
16622 
16623  for (iDim = 0 ; iDim < nDim; iDim++){
16624  for (jDim = 0 ; jDim < nDim; jDim++){
16625  for (kDim = 0 ; kDim < nDim; kDim++){
16626  O_ik = (Grad_Vel[iDim][kDim] - Grad_Vel[kDim][iDim])/ den_aux;
16627  O_jk = (Grad_Vel[jDim][kDim] - Grad_Vel[kDim][jDim])/ den_aux;
16628  Tau[iDim][jDim] -= c_cr1 * (O_ik * Tau[jDim][kDim] + O_jk * Tau[iDim][kDim]);
16629  }
16630  }
16631  }
16632 
16633  }
16634 
16635  /*--- Project Tau in each surface element ---*/
16636 
16637  for (iDim = 0; iDim < nDim; iDim++) {
16638  TauElem[iDim] = 0.0;
16639  for (jDim = 0; jDim < nDim; jDim++) {
16640  TauElem[iDim] += Tau[iDim][jDim]*UnitNormal[jDim];
16641  }
16642  }
16643 
16644  /*--- Compute wall shear stress (using the stress tensor). Compute wall skin friction coefficient, and heat flux on the wall ---*/
16645 
16646  TauNormal = 0.0; for (iDim = 0; iDim < nDim; iDim++) TauNormal += TauElem[iDim] * UnitNormal[iDim];
16647 
16648  WallShearStress = 0.0;
16649  for (iDim = 0; iDim < nDim; iDim++) {
16650  TauTangent[iDim] = TauElem[iDim] - TauNormal * UnitNormal[iDim];
16651  CSkinFriction[iMarker][iDim][iVertex] = TauTangent[iDim] / (0.5*RefDensity*RefVel2);
16652  WallShearStress += TauTangent[iDim] * TauTangent[iDim];
16653  }
16654  WallShearStress = sqrt(WallShearStress);
16655 
16656  for (iDim = 0; iDim < nDim; iDim++) WallDist[iDim] = (Coord[iDim] - Coord_Normal[iDim]);
16657  WallDistMod = 0.0; for (iDim = 0; iDim < nDim; iDim++) WallDistMod += WallDist[iDim]*WallDist[iDim]; WallDistMod = sqrt(WallDistMod);
16658 
16659  /*--- Compute y+ and non-dimensional velocity ---*/
16660 
16661  FrictionVel = sqrt(fabs(WallShearStress)/Density);
16662  YPlus[iMarker][iVertex] = WallDistMod*FrictionVel/(Viscosity/Density);
16663 
16664  /*--- Compute total and maximum heat flux on the wall ---*/
16665 
16666  GradTemperature = 0.0;
16667  for (iDim = 0; iDim < nDim; iDim++)
16668  GradTemperature -= Grad_Temp[iDim]*UnitNormal[iDim];
16669 
16670  Cp = (Gamma / Gamma_Minus_One) * Gas_Constant;
16671  thermal_conductivity = Cp * Viscosity/Prandtl_Lam;
16672  HeatFlux[iMarker][iVertex] = -thermal_conductivity*GradTemperature;
16673  HF_Visc[iMarker] += HeatFlux[iMarker][iVertex]*Area;
16674  MaxHF_Visc[iMarker] += pow(HeatFlux[iMarker][iVertex], MaxNorm);
16675 
16676 
16677  /*--- Note that y+, and heat are computed at the
16678  halo cells (for visualization purposes), but not the forces ---*/
16679 
16680  if ((geometry->node[iPoint]->GetDomain()) && (Monitoring == YES)) {
16681 
16682  /*--- Axisymmetric simulations ---*/
16683 
16684  if (axisymmetric) AxiFactor = 2.0*PI_NUMBER*geometry->node[iPoint]->GetCoord(1);
16685  else AxiFactor = 1.0;
16686 
16687  /*--- Force computation ---*/
16688 
16689  for (iDim = 0; iDim < nDim; iDim++) {
16690  Force[iDim] = TauElem[iDim] * Area * factor * AxiFactor;
16691  ForceViscous[iDim] += Force[iDim];
16692  MomentDist[iDim] = Coord[iDim] - Origin[iDim];
16693  }
16694 
16695  /*--- Moment with respect to the reference axis ---*/
16696 
16697  if (iDim == 3) {
16698  MomentViscous[0] += (Force[2]*MomentDist[1] - Force[1]*MomentDist[2])/RefLength;
16699  MomentX_Force[1] += (-Force[1]*Coord[2]);
16700  MomentX_Force[2] += (Force[2]*Coord[1]);
16701 
16702  MomentViscous[1] += (Force[0]*MomentDist[2] - Force[2]*MomentDist[0])/RefLength;
16703  MomentY_Force[2] += (-Force[2]*Coord[0]);
16704  MomentY_Force[0] += (Force[0]*Coord[2]);
16705  }
16706  MomentViscous[2] += (Force[1]*MomentDist[0] - Force[0]*MomentDist[1])/RefLength;
16707  MomentZ_Force[0] += (-Force[0]*Coord[1]);
16708  MomentZ_Force[1] += (Force[1]*Coord[0]);
16709 
16710  }
16711 
16712  }
16713 
16714  /*--- Project forces and store the non-dimensional coefficients ---*/
16715 
16716  if (Monitoring == YES) {
16717  if (nDim == 2) {
16718  CD_Visc[iMarker] = ForceViscous[0]*cos(Alpha) + ForceViscous[1]*sin(Alpha);
16719  CL_Visc[iMarker] = -ForceViscous[0]*sin(Alpha) + ForceViscous[1]*cos(Alpha);
16720  CEff_Visc[iMarker] = CL_Visc[iMarker] / (CD_Visc[iMarker]+EPS);
16721  CFx_Visc[iMarker] = ForceViscous[0];
16722  CFy_Visc[iMarker] = ForceViscous[1];
16723  CMz_Visc[iMarker] = MomentViscous[2];
16724  CoPx_Visc[iMarker] = MomentZ_Force[1];
16725  CoPy_Visc[iMarker] = -MomentZ_Force[0];
16726  CT_Visc[iMarker] = -CFx_Visc[iMarker];
16727  CQ_Visc[iMarker] = -CMz_Visc[iMarker];
16728  CMerit_Visc[iMarker] = CT_Visc[iMarker] / (CQ_Visc[iMarker]+EPS);
16729  MaxHF_Visc[iMarker] = pow(MaxHF_Visc[iMarker], 1.0/MaxNorm);
16730  }
16731  if (nDim == 3) {
16732  CD_Visc[iMarker] = ForceViscous[0]*cos(Alpha)*cos(Beta) + ForceViscous[1]*sin(Beta) + ForceViscous[2]*sin(Alpha)*cos(Beta);
16733  CL_Visc[iMarker] = -ForceViscous[0]*sin(Alpha) + ForceViscous[2]*cos(Alpha);
16734  CSF_Visc[iMarker] = -ForceViscous[0]*sin(Beta)*cos(Alpha) + ForceViscous[1]*cos(Beta) - ForceViscous[2]*sin(Beta)*sin(Alpha);
16735  CEff_Visc[iMarker] = CL_Visc[iMarker]/(CD_Visc[iMarker] + EPS);
16736  CFx_Visc[iMarker] = ForceViscous[0];
16737  CFy_Visc[iMarker] = ForceViscous[1];
16738  CFz_Visc[iMarker] = ForceViscous[2];
16739  CMx_Visc[iMarker] = MomentViscous[0];
16740  CMy_Visc[iMarker] = MomentViscous[1];
16741  CMz_Visc[iMarker] = MomentViscous[2];
16742  CoPx_Visc[iMarker] = -MomentY_Force[0];
16743  CoPz_Visc[iMarker] = MomentY_Force[2];
16744  CT_Visc[iMarker] = -CFz_Visc[iMarker];
16745  CQ_Visc[iMarker] = -CMz_Visc[iMarker];
16746  CMerit_Visc[iMarker] = CT_Visc[iMarker] / (CQ_Visc[iMarker] + EPS);
16747  MaxHF_Visc[iMarker] = pow(MaxHF_Visc[iMarker], 1.0/MaxNorm);
16748  }
16749 
16750  AllBound_CD_Visc += CD_Visc[iMarker];
16751  AllBound_CL_Visc += CL_Visc[iMarker];
16752  AllBound_CSF_Visc += CSF_Visc[iMarker];
16753  AllBound_CFx_Visc += CFx_Visc[iMarker];
16754  AllBound_CFy_Visc += CFy_Visc[iMarker];
16755  AllBound_CFz_Visc += CFz_Visc[iMarker];
16756  AllBound_CMx_Visc += CMx_Visc[iMarker];
16757  AllBound_CMy_Visc += CMy_Visc[iMarker];
16758  AllBound_CMz_Visc += CMz_Visc[iMarker];
16759  AllBound_CoPx_Visc += CoPx_Visc[iMarker];
16760  AllBound_CoPy_Visc += CoPy_Visc[iMarker];
16761  AllBound_CoPz_Visc += CoPz_Visc[iMarker];
16762  AllBound_CT_Visc += CT_Visc[iMarker];
16763  AllBound_CQ_Visc += CQ_Visc[iMarker];
16764  AllBound_HF_Visc += HF_Visc[iMarker];
16765  AllBound_MaxHF_Visc += pow(MaxHF_Visc[iMarker], MaxNorm);
16766 
16767  /*--- Compute the coefficients per surface ---*/
16768 
16769  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
16770  Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
16771  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
16772  if (Marker_Tag == Monitoring_Tag) {
16773  Surface_CL_Visc[iMarker_Monitoring] += CL_Visc[iMarker];
16774  Surface_CD_Visc[iMarker_Monitoring] += CD_Visc[iMarker];
16775  Surface_CSF_Visc[iMarker_Monitoring] += CSF_Visc[iMarker];
16776  Surface_CEff_Visc[iMarker_Monitoring] += CEff_Visc[iMarker];
16777  Surface_CFx_Visc[iMarker_Monitoring] += CFx_Visc[iMarker];
16778  Surface_CFy_Visc[iMarker_Monitoring] += CFy_Visc[iMarker];
16779  Surface_CFz_Visc[iMarker_Monitoring] += CFz_Visc[iMarker];
16780  Surface_CMx_Visc[iMarker_Monitoring] += CMx_Visc[iMarker];
16781  Surface_CMy_Visc[iMarker_Monitoring] += CMy_Visc[iMarker];
16782  Surface_CMz_Visc[iMarker_Monitoring] += CMz_Visc[iMarker];
16783  Surface_HF_Visc[iMarker_Monitoring] += HF_Visc[iMarker];
16784  Surface_MaxHF_Visc[iMarker_Monitoring] += pow(MaxHF_Visc[iMarker],MaxNorm);
16785  }
16786  }
16787 
16788  }
16789 
16790  }
16791  }
16792 
16793  /*--- Update some global coeffients ---*/
16794 
16795  AllBound_CEff_Visc = AllBound_CL_Visc / (AllBound_CD_Visc + EPS);
16796  AllBound_CMerit_Visc = AllBound_CT_Visc / (AllBound_CQ_Visc + EPS);
16797  AllBound_MaxHF_Visc = pow(AllBound_MaxHF_Visc, 1.0/MaxNorm);
16798 
16799 
16800 #ifdef HAVE_MPI
16801 
16802  /*--- Add AllBound information using all the nodes ---*/
16803 
16804  MyAllBound_CD_Visc = AllBound_CD_Visc; AllBound_CD_Visc = 0.0;
16805  MyAllBound_CL_Visc = AllBound_CL_Visc; AllBound_CL_Visc = 0.0;
16806  MyAllBound_CSF_Visc = AllBound_CSF_Visc; AllBound_CSF_Visc = 0.0;
16807  AllBound_CEff_Visc = 0.0;
16808  MyAllBound_CMx_Visc = AllBound_CMx_Visc; AllBound_CMx_Visc = 0.0;
16809  MyAllBound_CMy_Visc = AllBound_CMy_Visc; AllBound_CMy_Visc = 0.0;
16810  MyAllBound_CMz_Visc = AllBound_CMz_Visc; AllBound_CMz_Visc = 0.0;
16811  MyAllBound_CoPx_Visc = AllBound_CoPx_Visc; AllBound_CoPx_Visc = 0.0;
16812  MyAllBound_CoPy_Visc = AllBound_CoPy_Visc; AllBound_CoPy_Visc = 0.0;
16813  MyAllBound_CoPz_Visc = AllBound_CoPz_Visc; AllBound_CoPz_Visc = 0.0;
16814  MyAllBound_CFx_Visc = AllBound_CFx_Visc; AllBound_CFx_Visc = 0.0;
16815  MyAllBound_CFy_Visc = AllBound_CFy_Visc; AllBound_CFy_Visc = 0.0;
16816  MyAllBound_CFz_Visc = AllBound_CFz_Visc; AllBound_CFz_Visc = 0.0;
16817  MyAllBound_CT_Visc = AllBound_CT_Visc; AllBound_CT_Visc = 0.0;
16818  MyAllBound_CQ_Visc = AllBound_CQ_Visc; AllBound_CQ_Visc = 0.0;
16819  AllBound_CMerit_Visc = 0.0;
16820  MyAllBound_HF_Visc = AllBound_HF_Visc; AllBound_HF_Visc = 0.0;
16821  MyAllBound_MaxHF_Visc = pow(AllBound_MaxHF_Visc, MaxNorm); AllBound_MaxHF_Visc = 0.0;
16822 
16823  SU2_MPI::Allreduce(&MyAllBound_CD_Visc, &AllBound_CD_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16824  SU2_MPI::Allreduce(&MyAllBound_CL_Visc, &AllBound_CL_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16825  SU2_MPI::Allreduce(&MyAllBound_CSF_Visc, &AllBound_CSF_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16826  AllBound_CEff_Visc = AllBound_CL_Visc / (AllBound_CD_Visc + EPS);
16827  SU2_MPI::Allreduce(&MyAllBound_CMx_Visc, &AllBound_CMx_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16828  SU2_MPI::Allreduce(&MyAllBound_CMy_Visc, &AllBound_CMy_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16829  SU2_MPI::Allreduce(&MyAllBound_CMz_Visc, &AllBound_CMz_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16830  SU2_MPI::Allreduce(&MyAllBound_CFx_Visc, &AllBound_CFx_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16831  SU2_MPI::Allreduce(&MyAllBound_CFy_Visc, &AllBound_CFy_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16832  SU2_MPI::Allreduce(&MyAllBound_CFz_Visc, &AllBound_CFz_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16833  SU2_MPI::Allreduce(&MyAllBound_CoPx_Visc, &AllBound_CoPx_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16834  SU2_MPI::Allreduce(&MyAllBound_CoPy_Visc, &AllBound_CoPy_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16835  SU2_MPI::Allreduce(&MyAllBound_CoPz_Visc, &AllBound_CoPz_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16836  SU2_MPI::Allreduce(&MyAllBound_CT_Visc, &AllBound_CT_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16837  SU2_MPI::Allreduce(&MyAllBound_CQ_Visc, &AllBound_CQ_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16838  AllBound_CMerit_Visc = AllBound_CT_Visc / (AllBound_CQ_Visc + EPS);
16839  SU2_MPI::Allreduce(&MyAllBound_HF_Visc, &AllBound_HF_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16840  SU2_MPI::Allreduce(&MyAllBound_MaxHF_Visc, &AllBound_MaxHF_Visc, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16841  AllBound_MaxHF_Visc = pow(AllBound_MaxHF_Visc, 1.0/MaxNorm);
16842 
16843  /*--- Add the forces on the surfaces using all the nodes ---*/
16844 
16845  MySurface_CL_Visc = new su2double[config->GetnMarker_Monitoring()];
16846  MySurface_CD_Visc = new su2double[config->GetnMarker_Monitoring()];
16847  MySurface_CSF_Visc = new su2double[config->GetnMarker_Monitoring()];
16848  MySurface_CEff_Visc = new su2double[config->GetnMarker_Monitoring()];
16849  MySurface_CFx_Visc = new su2double[config->GetnMarker_Monitoring()];
16850  MySurface_CFy_Visc = new su2double[config->GetnMarker_Monitoring()];
16851  MySurface_CFz_Visc = new su2double[config->GetnMarker_Monitoring()];
16852  MySurface_CMx_Visc = new su2double[config->GetnMarker_Monitoring()];
16853  MySurface_CMy_Visc = new su2double[config->GetnMarker_Monitoring()];
16854  MySurface_CMz_Visc = new su2double[config->GetnMarker_Monitoring()];
16855  MySurface_HF_Visc = new su2double[config->GetnMarker_Monitoring()];
16856  MySurface_MaxHF_Visc = new su2double[config->GetnMarker_Monitoring()];
16857 
16858  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
16859 
16860  MySurface_CL_Visc[iMarker_Monitoring] = Surface_CL_Visc[iMarker_Monitoring];
16861  MySurface_CD_Visc[iMarker_Monitoring] = Surface_CD_Visc[iMarker_Monitoring];
16862  MySurface_CSF_Visc[iMarker_Monitoring] = Surface_CSF_Visc[iMarker_Monitoring];
16863  MySurface_CEff_Visc[iMarker_Monitoring] = Surface_CEff_Visc[iMarker_Monitoring];
16864  MySurface_CFx_Visc[iMarker_Monitoring] = Surface_CFx_Visc[iMarker_Monitoring];
16865  MySurface_CFy_Visc[iMarker_Monitoring] = Surface_CFy_Visc[iMarker_Monitoring];
16866  MySurface_CFz_Visc[iMarker_Monitoring] = Surface_CFz_Visc[iMarker_Monitoring];
16867  MySurface_CMx_Visc[iMarker_Monitoring] = Surface_CMx_Visc[iMarker_Monitoring];
16868  MySurface_CMy_Visc[iMarker_Monitoring] = Surface_CMy_Visc[iMarker_Monitoring];
16869  MySurface_CMz_Visc[iMarker_Monitoring] = Surface_CMz_Visc[iMarker_Monitoring];
16870  MySurface_HF_Visc[iMarker_Monitoring] = Surface_HF_Visc[iMarker_Monitoring];
16871  MySurface_MaxHF_Visc[iMarker_Monitoring] = Surface_MaxHF_Visc[iMarker_Monitoring];
16872 
16873  Surface_CL_Visc[iMarker_Monitoring] = 0.0;
16874  Surface_CD_Visc[iMarker_Monitoring] = 0.0;
16875  Surface_CSF_Visc[iMarker_Monitoring] = 0.0;
16876  Surface_CEff_Visc[iMarker_Monitoring] = 0.0;
16877  Surface_CFx_Visc[iMarker_Monitoring] = 0.0;
16878  Surface_CFy_Visc[iMarker_Monitoring] = 0.0;
16879  Surface_CFz_Visc[iMarker_Monitoring] = 0.0;
16880  Surface_CMx_Visc[iMarker_Monitoring] = 0.0;
16881  Surface_CMy_Visc[iMarker_Monitoring] = 0.0;
16882  Surface_CMz_Visc[iMarker_Monitoring] = 0.0;
16883  Surface_HF_Visc[iMarker_Monitoring] = 0.0;
16884  Surface_MaxHF_Visc[iMarker_Monitoring] = 0.0;
16885  }
16886 
16887  SU2_MPI::Allreduce(MySurface_CL_Visc, Surface_CL_Visc, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16888  SU2_MPI::Allreduce(MySurface_CD_Visc, Surface_CD_Visc, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16889  SU2_MPI::Allreduce(MySurface_CSF_Visc, Surface_CSF_Visc, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16890  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++)
16891  Surface_CEff_Visc[iMarker_Monitoring] = Surface_CL_Visc[iMarker_Monitoring] / (Surface_CD_Visc[iMarker_Monitoring] + EPS);
16892  SU2_MPI::Allreduce(MySurface_CFx_Visc, Surface_CFx_Visc, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16893  SU2_MPI::Allreduce(MySurface_CFy_Visc, Surface_CFy_Visc, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16894  SU2_MPI::Allreduce(MySurface_CFz_Visc, Surface_CFz_Visc, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16895  SU2_MPI::Allreduce(MySurface_CMx_Visc, Surface_CMx_Visc, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16896  SU2_MPI::Allreduce(MySurface_CMy_Visc, Surface_CMy_Visc, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16897  SU2_MPI::Allreduce(MySurface_CMz_Visc, Surface_CMz_Visc, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
16900 
16901  delete [] MySurface_CL_Visc; delete [] MySurface_CD_Visc; delete [] MySurface_CSF_Visc;
16902  delete [] MySurface_CEff_Visc; delete [] MySurface_CFx_Visc; delete [] MySurface_CFy_Visc;
16903  delete [] MySurface_CFz_Visc; delete [] MySurface_CMx_Visc; delete [] MySurface_CMy_Visc;
16904  delete [] MySurface_CMz_Visc; delete [] MySurface_HF_Visc; delete [] MySurface_MaxHF_Visc;
16905 
16906 #endif
16907 
16908  /*--- Update the total coefficients (note that all the nodes have the same value)---*/
16909 
16910  Total_CD += AllBound_CD_Visc;
16911  Total_CL += AllBound_CL_Visc;
16912  Total_CSF += AllBound_CSF_Visc;
16913  Total_CEff = Total_CL / (Total_CD + EPS);
16914  Total_CFx += AllBound_CFx_Visc;
16915  Total_CFy += AllBound_CFy_Visc;
16916  Total_CFz += AllBound_CFz_Visc;
16917  Total_CMx += AllBound_CMx_Visc;
16918  Total_CMy += AllBound_CMy_Visc;
16919  Total_CMz += AllBound_CMz_Visc;
16920  Total_CoPx += AllBound_CoPx_Visc;
16921  Total_CoPy += AllBound_CoPy_Visc;
16922  Total_CoPz += AllBound_CoPz_Visc;
16923  Total_CT += AllBound_CT_Visc;
16924  Total_CQ += AllBound_CQ_Visc;
16925  Total_CMerit = AllBound_CT_Visc / (AllBound_CQ_Visc + EPS);
16926  Total_Heat = AllBound_HF_Visc;
16927  Total_MaxHeat = AllBound_MaxHF_Visc;
16928 
16929  /*--- Update the total coefficients per surface (note that all the nodes have the same value)---*/
16930 
16931  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
16932  Surface_CL[iMarker_Monitoring] += Surface_CL_Visc[iMarker_Monitoring];
16933  Surface_CD[iMarker_Monitoring] += Surface_CD_Visc[iMarker_Monitoring];
16934  Surface_CSF[iMarker_Monitoring] += Surface_CSF_Visc[iMarker_Monitoring];
16935  Surface_CEff[iMarker_Monitoring] = Surface_CL[iMarker_Monitoring] / (Surface_CD[iMarker_Monitoring] + EPS);
16936  Surface_CFx[iMarker_Monitoring] += Surface_CFx_Visc[iMarker_Monitoring];
16937  Surface_CFy[iMarker_Monitoring] += Surface_CFy_Visc[iMarker_Monitoring];
16938  Surface_CFz[iMarker_Monitoring] += Surface_CFz_Visc[iMarker_Monitoring];
16939  Surface_CMx[iMarker_Monitoring] += Surface_CMx_Visc[iMarker_Monitoring];
16940  Surface_CMy[iMarker_Monitoring] += Surface_CMy_Visc[iMarker_Monitoring];
16941  Surface_CMz[iMarker_Monitoring] += Surface_CMz_Visc[iMarker_Monitoring];
16942  }
16943 
16944 }
16945 
16946 void CNSSolver::BC_Euler_Transpiration(CGeometry *geometry, CSolver **solver_container,
16947  CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
16948 
16949  unsigned short iDim, jDim, iVar, jVar, Wall_Function;
16950  unsigned long iVertex, iPoint, Point_Normal, total_index, mflux_ramp = 999;
16951 
16952  su2double Wall_HeatFlux, dist_ij, *Coord_i, *Coord_j, theta2;
16953  su2double thetax, thetay, thetaz, etax, etay, etaz, pix, piy, piz, factor;
16954  su2double ProjGridVel, *GridVel, GridVel2, *Normal, Area, Pressure = 0.0, Entropy;
16955  su2double total_viscosity, div_vel, Density, tau_vel[3] = {0.0, 0.0, 0.0}, UnitNormal[3] = {0.0, 0.0, 0.0}, Velocity[3] = {0.0, 0.0, 0.0};
16956  su2double laminar_viscosity = 0.0, eddy_viscosity = 0.0, Grad_Vel[3][3] = {{0.0,0.0,0.0},{0.0,0.0,0.0},{0.0,0.0,0.0}},
16957  tau[3][3] = {{0.0,0.0,0.0},{0.0,0.0,0.0},{0.0,0.0,0.0}};
16958  su2double delta[3][3] = {{1.0, 0.0, 0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}};
16959  su2double VelEps = 0.0;
16960  su2double Riemann, SoundSpeed2, Vel_Mag, Energy;
16961  su2double *V_transp, *V_domain;
16962 
16963  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
16964  bool grid_movement = config->GetGrid_Movement();
16965  su2double Two_Gamma_M1 = 2.0/Gamma_Minus_One;
16966  su2double Gas_Constant = config->GetGas_ConstantND();
16967  bool gravity = (config->GetGravityForce());
16968  bool tkeNeeded = (((config->GetKind_Solver() == RANS )|| (config->GetKind_Solver() == DISC_ADJ_RANS)) &&
16969  (config->GetKind_Turb_Model() == SST));
16970 
16971  /*--- Identify the boundary by string name ---*/
16972 
16973  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
16974 
16975  /*--- Get the specified wall heat flux from config as well as the
16976  wall function treatment.---*/
16977 
16978  Wall_HeatFlux = 0.0;
16979  Wall_Function = NO_WALL_FUNCTION;
16980  if(Wall_Function != NO_WALL_FUNCTION) {
16981  SU2_MPI::Error("Wall function treament not implemented yet", CURRENT_FUNCTION);
16982  }
16983 
16984  /*--- Loop over all of the vertices on this boundary marker ---*/
16985 
16986  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
16987  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
16988 
16989  /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
16990 
16991  if (geometry->node[iPoint]->GetDomain()) {
16992 
16993  /*--- Compute dual-grid area and boundary normal ---*/
16994 
16995  Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
16996  VelEps = node[iPoint]->GetTranspiration();
16997  if(!config->GetRestart() && !config->GetRestart_Flow()){
16998  VelEps *= min(1.0, su2double(config->GetExtIter()/mflux_ramp));
16999  }
17000 
17001  Area = 0.0;
17002  for (iDim = 0; iDim < nDim; iDim++)
17003  Area += Normal[iDim]*Normal[iDim];
17004  Area = sqrt (Area);
17005 
17006  for (iDim = 0; iDim < nDim; iDim++)
17007  UnitNormal[iDim] = -Normal[iDim]/Area;
17008 
17009  /*--- Initialize the convective & viscous residuals to zero ---*/
17010 
17011  for (iVar = 0; iVar < nVar; iVar++) {
17012  Res_Conv[iVar] = 0.0;
17013  Res_Visc[iVar] = 0.0;
17014  }
17015 
17016  /*--- Store the corrected velocity at the wall which will
17017  be zero (v = 0), unless there are moving walls (v = u_wall)---*/
17018 
17019  if (grid_movement) {
17020  GridVel = geometry->node[iPoint]->GetGridVel();
17021  for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = GridVel[iDim] - VelEps * UnitNormal[iDim];
17022  } else {
17023  for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = -VelEps * UnitNormal[iDim];
17024  }
17025 
17026  /*--- Impose the value of the velocity as a strong boundary
17027  condition (Dirichlet). Fix the velocity and remove any
17028  contribution to the residual at this node. ---*/
17029 
17030  node[iPoint]->SetVelocity_Old(Vector);
17031 
17032  for (iDim = 0; iDim < nDim; iDim++)
17033  LinSysRes.SetBlock_Zero(iPoint, iDim+1);
17034  node[iPoint]->SetVel_ResTruncError_Zero();
17035 
17036 
17037 
17038 
17039  /*--- Retrieve other primitive quantities and viscosities ---*/
17040 
17041  Density = node[iPoint]->GetSolution(0);
17042  Pressure = node[iPoint]->GetPressure();
17043  Energy = node[iPoint]->GetEnergy();
17044  laminar_viscosity = node[iPoint]->GetLaminarViscosity();
17045  eddy_viscosity = node[iPoint]->GetEddyViscosity();
17046  total_viscosity = laminar_viscosity + eddy_viscosity;
17047 
17048  for (iDim = 0; iDim < nDim; iDim++) {
17049  for (jDim = 0 ; jDim < nDim; jDim++) {
17050  Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim);
17051  }
17052  }
17053 
17054  /*--- Divergence of the velocity ---*/
17055 
17056  div_vel = 0.0; for (iDim = 0 ; iDim < nDim; iDim++) div_vel += Grad_Vel[iDim][iDim];
17057 
17058  /*--- Compute the viscous stress tensor ---*/
17059 
17060  for (iDim = 0; iDim < nDim; iDim++) {
17061  for (jDim = 0; jDim < nDim; jDim++) {
17062  tau[iDim][jDim] = total_viscosity*( Grad_Vel[jDim][iDim]+Grad_Vel[iDim][jDim] ) - TWO3*total_viscosity*div_vel*delta[iDim][jDim];
17063  }
17064  }
17065 
17066  /*--- Dot product of the stress tensor with the grid velocity ---*/
17067 
17068  for (iDim = 0 ; iDim < nDim; iDim++) {
17069  tau_vel[iDim] = 0.0;
17070  for (jDim = 0 ; jDim < nDim; jDim++)
17071  tau_vel[iDim] += tau[iDim][jDim]*Vector[jDim];
17072  }
17073 
17074  /*--- Compute the convective and viscous residuals (energy eqn.) ---*/
17075 
17076  for (iDim = 0 ; iDim < nDim; iDim++){
17077  Res_Conv[0] += Density*Vector[iDim]*UnitNormal[iDim]*Area;
17078  Res_Conv[nDim+1] += (Density*Energy + Pressure)*Vector[iDim]*UnitNormal[iDim]*Area;
17079  Res_Visc[nDim+1] += tau_vel[iDim]*UnitNormal[iDim]*Area;
17080  }
17081 
17082  // /*--- Implicit Jacobian contributions due to moving walls ---*/
17083 
17084  // if (implicit) {
17085 
17086  // /*--- Jacobian contribution related to the pressure term ---*/
17087 
17088  // GridVel2 = 0.0;
17089  // for (iDim = 0; iDim < nDim; iDim++)
17090  // GridVel2 += Vector[iDim]*Vector[iDim];
17091  // for (iVar = 0; iVar < nVar; iVar++)
17092  // for (jVar = 0; jVar < nVar; jVar++)
17093  // Jacobian_i[iVar][jVar] = 0.0;
17094  // Jacobian_i[nDim+1][0] = 0.5*(Gamma-1.0)*GridVel2*VelEps;
17095  // for (jDim = 0; jDim < nDim; jDim++)
17096  // Jacobian_i[nDim+1][jDim+1] = -(Gamma-1.0)*Vector[jDim]*VelEps;
17097  // Jacobian_i[nDim+1][nDim+1] = (Gamma-1.0)*VelEps;
17098 
17099  // /*--- Add the block to the Global Jacobian structure ---*/
17100 
17101  // Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
17102 
17103  // /*--- Now the Jacobian contribution related to the shear stress ---*/
17104 
17105  // for (iVar = 0; iVar < nVar; iVar++)
17106  // for (jVar = 0; jVar < nVar; jVar++)
17107  // Jacobian_i[iVar][jVar] = 0.0;
17108 
17109  // /*--- Compute closest normal neighbor ---*/
17110 
17111  // Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
17112 
17113  // /*--- Get coordinates of i & nearest normal and compute distance ---*/
17114 
17115  // Coord_i = geometry->node[iPoint]->GetCoord();
17116  // Coord_j = geometry->node[Point_Normal]->GetCoord();
17117 
17118  // dist_ij = 0;
17119  // for (iDim = 0; iDim < nDim; iDim++)
17120  // dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
17121  // dist_ij = sqrt(dist_ij);
17122 
17123  // theta2 = 0.0;
17124  // for (iDim = 0; iDim < nDim; iDim++)
17125  // theta2 += UnitNormal[iDim]*UnitNormal[iDim];
17126 
17127  // factor = total_viscosity*Area/(Density*dist_ij);
17128 
17129  // if (nDim == 2) {
17130  // thetax = theta2 + UnitNormal[0]*UnitNormal[0]/3.0;
17131  // thetay = theta2 + UnitNormal[1]*UnitNormal[1]/3.0;
17132 
17133  // etaz = UnitNormal[0]*UnitNormal[1]/3.0;
17134 
17135  // pix = Vector[0]*thetax + Vector[1]*etaz;
17136  // piy = Vector[0]*etaz + Vector[1]*thetay;
17137 
17138  // Jacobian_i[nDim+1][0] -= factor*(-pix*Vector[0]+piy*Vector[1]);
17139  // Jacobian_i[nDim+1][1] -= factor*pix;
17140  // Jacobian_i[nDim+1][2] -= factor*piy;
17141  // } else {
17142  // thetax = theta2 + UnitNormal[0]*UnitNormal[0]/3.0;
17143  // thetay = theta2 + UnitNormal[1]*UnitNormal[1]/3.0;
17144  // thetaz = theta2 + UnitNormal[2]*UnitNormal[2]/3.0;
17145 
17146  // etaz = UnitNormal[0]*UnitNormal[1]/3.0;
17147  // etax = UnitNormal[1]*UnitNormal[2]/3.0;
17148  // etay = UnitNormal[0]*UnitNormal[2]/3.0;
17149 
17150  // pix = Vector[0]*thetax + Vector[1]*etaz + Vector[2]*etay;
17151  // piy = Vector[0]*etaz + Vector[1]*thetay + Vector[2]*etax;
17152  // piz = Vector[0]*etay + Vector[1]*etax + Vector[2]*thetaz;
17153 
17154  // Jacobian_i[nDim+1][0] -= factor*(-pix*Vector[0]+piy*Vector[1]+piz*Vector[2]);
17155  // Jacobian_i[nDim+1][1] -= factor*pix;
17156  // Jacobian_i[nDim+1][2] -= factor*piy;
17157  // Jacobian_i[nDim+1][3] -= factor*piz;
17158  // }
17159 
17160  // /*--- Subtract the block from the Global Jacobian structure ---*/
17161 
17162  // Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
17163 
17164  // }
17165 
17166  /*--- Convective contribution to the residual at the wall ---*/
17167 
17168  LinSysRes.AddBlock(iPoint, Res_Conv);
17169 
17170  /*--- Viscous contribution to the residual at the wall ---*/
17171 
17172  LinSysRes.SubtractBlock(iPoint, Res_Visc);
17173 
17174  /*--- Enforce the no-slip boundary condition in a strong way by
17175  modifying the velocity-rows of the Jacobian (1 on the diagonal). ---*/
17176 
17177  if (implicit) {
17178  for (iVar = 1; iVar <= nDim; iVar++) {
17179  total_index = iPoint*nVar+iVar;
17180  Jacobian.DeleteValsRowi(total_index);
17181  }
17182  }
17183 
17184  }
17185  }
17186 
17187  /*--- Free locally allocated memory ---*/
17188 
17189  // if(Normal != NULL) delete [] Normal;
17190  // if(GridVel != NULL) delete [] GridVel;
17191  // if(V_transp != NULL) delete [] V_transp;
17192  // if(V_domain != NULL) delete [] V_domain;
17193  // if(Coord_i != NULL) delete [] Coord_i;
17194  // if(Coord_j != NULL) delete [] Coord_j;
17195 
17196 }
17197 
17199 
17200  unsigned long iVertex, iPoint;
17201  unsigned short Boundary, Monitoring, iMarker, iMarker_Monitoring, iDim, jDim;
17202  su2double *Vel_FS = config->GetVelocity_FreeStreamND();
17203  su2double Density, Viscosity, div_vel;
17204  su2double TauNormal, UnitNormal[3] = {0.0, 0.0, 0.0}, TauElem[3] = {0.0, 0.0, 0.0}, TauTangent[3] = {0.0, 0.0, 0.0},
17205  Tau[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.0, 0.0}}, Force[3] = {0.0, 0.0, 0.0}, Cp, thermal_conductivity, MaxNorm = 8.0,
17206  Grad_Vel[3][3] = {{0.0, 0.0, 0.0},{0.0, 0.0, 0.0},{0.0, 0.0, 0.0}}, Grad_Temp[3] = {0.0, 0.0, 0.0},
17207  delta[3][3] = {{1.0, 0.0, 0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}};
17208  su2double VelMag_FS = 0.0, SkinFrictionMag = 0.0, SkinFrictionDot = 0.0, *Normal, Area, Sref = config->GetRefArea();
17209  su2double k = config->GetBuffet_k(),
17210  lam = config->GetBuffet_lambda();
17211  string Marker_Tag, Monitoring_Tag;
17212 
17213  for (iDim = 0; iDim < nDim; iDim++){
17214  VelMag_FS += Vel_FS[iDim]*Vel_FS[iDim];
17215  }
17216  VelMag_FS = sqrt(VelMag_FS);
17217 
17218  /*-- Variables initialization ---*/
17219 
17220  Total_Buffet_Metric = 0.0;
17221 
17222  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
17223  Surface_Buffet_Metric[iMarker_Monitoring] = 0.0;
17224  }
17225 
17226  /*--- Loop over the Euler and Navier-Stokes markers ---*/
17227 
17228  for (iMarker = 0; iMarker < nMarker; iMarker++) {
17229 
17230  Buffet_Metric[iMarker] = 0.0;
17231 
17232  Boundary = config->GetMarker_All_KindBC(iMarker);
17233  Monitoring = config->GetMarker_All_Monitoring(iMarker);
17234 
17235  if ((Boundary == HEAT_FLUX) || (Boundary == ISOTHERMAL) || (Boundary == TRANSPIRATION)) {
17236 
17237  /*--- Loop over the vertices to compute the buffet sensor ---*/
17238 
17239  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
17240 
17241 
17242  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
17243 
17244  /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
17245 
17246  if (geometry->node[iPoint]->GetDomain()) {
17247 
17248  Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
17249 
17250  for (iDim = 0; iDim < nDim; iDim++) {
17251  for (jDim = 0 ; jDim < nDim; jDim++) {
17252  Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim);
17253  }
17254  }
17255 
17256  Viscosity = node[iPoint]->GetLaminarViscosity();
17257  Density = node[iPoint]->GetDensity();
17258 
17259  Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt(Area);
17260 
17261  for (iDim = 0; iDim < nDim; iDim++) {
17262  UnitNormal[iDim] = Normal[iDim]/Area;
17263  }
17264 
17265  /*--- Evaluate Tau ---*/
17266 
17267  div_vel = 0.0; for (iDim = 0; iDim < nDim; iDim++) div_vel += Grad_Vel[iDim][iDim];
17268 
17269  for (iDim = 0; iDim < nDim; iDim++) {
17270  for (jDim = 0 ; jDim < nDim; jDim++) {
17271  Tau[iDim][jDim] = Viscosity*(Grad_Vel[jDim][iDim] + Grad_Vel[iDim][jDim]) - TWO3*Viscosity*div_vel*delta[iDim][jDim];
17272  }
17273  }
17274 
17275  /*--- If necessary evaluate the QCR contribution to Tau ---*/
17276 
17277  if (config->GetQCR()){
17278  su2double den_aux, c_cr1=0.3, O_ik, O_jk;
17279  unsigned short kDim;
17280 
17281  /*--- Denominator Antisymmetric normalized rotation tensor ---*/
17282 
17283  den_aux = 0.0;
17284  for (iDim = 0 ; iDim < nDim; iDim++)
17285  for (jDim = 0 ; jDim < nDim; jDim++)
17286  den_aux += Grad_Vel[iDim][jDim] * Grad_Vel[iDim][jDim];
17287  den_aux = sqrt(max(den_aux,1E-10));
17288 
17289  /*--- Adding the QCR contribution ---*/
17290 
17291  for (iDim = 0 ; iDim < nDim; iDim++){
17292  for (jDim = 0 ; jDim < nDim; jDim++){
17293  for (kDim = 0 ; kDim < nDim; kDim++){
17294  O_ik = (Grad_Vel[iDim][kDim] - Grad_Vel[kDim][iDim])/ den_aux;
17295  O_jk = (Grad_Vel[jDim][kDim] - Grad_Vel[kDim][jDim])/ den_aux;
17296  Tau[iDim][jDim] -= c_cr1 * (O_ik * Tau[jDim][kDim] + O_jk * Tau[iDim][kDim]);
17297  }
17298  }
17299  }
17300 
17301  }
17302 
17303  /*--- Project Tau in each surface element ---*/
17304 
17305  for (iDim = 0; iDim < nDim; iDim++) {
17306  TauElem[iDim] = 0.0;
17307  for (jDim = 0; jDim < nDim; jDim++) {
17308  TauElem[iDim] += Tau[iDim][jDim]*UnitNormal[jDim];
17309  }
17310  }
17311 
17312  /*--- Compute wall shear stress (using the stress tensor). Compute wall skin friction coefficient, and heat flux on the wall ---*/
17313 
17314  TauNormal = 0.0; for (iDim = 0; iDim < nDim; iDim++) TauNormal += TauElem[iDim] * UnitNormal[iDim];
17315 
17316  for (iDim = 0; iDim < nDim; iDim++) {
17317  TauTangent[iDim] = TauElem[iDim] - TauNormal * UnitNormal[iDim];
17318  }
17319 
17320  /*--- Perform dot product of skin friction with freestream velocity ---*/
17321 
17322  SkinFrictionMag = 0.0;
17323  SkinFrictionDot = 0.0;
17324  for(iDim = 0; iDim < nDim; iDim++){
17325  // SkinFrictionMag += CSkinFriction[iMarker][iDim][iVertex]*CSkinFriction[iMarker][iDim][iVertex];
17326  // SkinFrictionDot += CSkinFriction[iMarker][iDim][iVertex]*Vel_FS[iDim];
17327  SkinFrictionMag += TauTangent[iDim]*TauTangent[iDim];
17328  SkinFrictionDot += TauTangent[iDim]*Vel_FS[iDim];
17329  }
17330  SkinFrictionMag = sqrt(SkinFrictionMag);
17331 
17332  /*--- Normalize the dot product ---*/
17333 
17334  SkinFrictionDot /= SkinFrictionMag*VelMag_FS;
17335 
17336  /*--- Compute Heaviside function ---*/
17337 
17338  Buffet_Sensor[iMarker][iVertex] = 1./(1. + exp(2.*k*(SkinFrictionDot + lam)));
17339 
17340  /*--- Integrate buffet sensor ---*/
17341 
17342  if(Monitoring == YES){
17343 
17344  // Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
17345  // Area = 0.0;
17346  // for(iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim];
17347  // Area = sqrt(Area);
17348 
17349  Buffet_Metric[iMarker] += Buffet_Sensor[iMarker][iVertex]*Area/Sref;
17350 
17351  }
17352 
17353  }
17354 
17355  }
17356 
17357  if(Monitoring == YES){
17358 
17359  Total_Buffet_Metric += Buffet_Metric[iMarker];
17360 
17361  /*--- Per surface buffet metric ---*/
17362 
17363  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
17364  Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
17365  Marker_Tag = config->GetMarker_All_TagBound(iMarker);
17366  if (Marker_Tag == Monitoring_Tag) Surface_Buffet_Metric[iMarker_Monitoring] = Buffet_Metric[iMarker];
17367  }
17368 
17369  }
17370 
17371  }
17372 
17373  }
17374 
17375 #ifdef HAVE_MPI
17376 
17377  /*--- Add buffet metric information using all the nodes ---*/
17378 
17379  su2double MyTotal_Buffet_Metric = Total_Buffet_Metric;
17380  Total_Buffet_Metric = 0.0;
17381 
17382  SU2_MPI::Allreduce(&MyTotal_Buffet_Metric, &Total_Buffet_Metric, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
17383 
17384  /*--- Add the buffet metric on the surfaces using all the nodes ---*/
17385 
17386  su2double *MySurface_Buffet_Metric = new su2double[config->GetnMarker_Monitoring()];
17387 
17388  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
17389 
17390  MySurface_Buffet_Metric[iMarker_Monitoring] = Surface_Buffet_Metric[iMarker_Monitoring];
17391  Surface_Buffet_Metric[iMarker_Monitoring] = 0.0;
17392 
17393  }
17394 
17395  SU2_MPI::Allreduce(MySurface_Buffet_Metric, Surface_Buffet_Metric, config->GetnMarker_Monitoring(), MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
17396 
17397  delete [] MySurface_Buffet_Metric;
17398 
17399 #endif
17400 
17401 }
17402 
17404 
17405  unsigned short iMarker_Monitoring, Kind_ObjFunc;
17406  su2double Weight_ObjFunc;
17407 
17408  Total_ComboObj = 0.0;
17409 
17410  /*--- Loop over all monitored markers, add to the 'combo' objective ---*/
17411 
17412  for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
17413 
17414  Weight_ObjFunc = config->GetWeight_ObjFunc(iMarker_Monitoring);
17415  Kind_ObjFunc = config->GetKind_ObjFunc(iMarker_Monitoring);
17416 
17417  switch(Kind_ObjFunc) {
17418  case DRAG_COEFFICIENT:
17419  Total_ComboObj+=Weight_ObjFunc*(Surface_CD[iMarker_Monitoring]);
17420  if (config->GetFixed_CL_Mode()) Total_ComboObj -= Weight_ObjFunc*config->GetdCD_dCL()*(Surface_CL[iMarker_Monitoring]);
17421  if (config->GetFixed_CM_Mode()) Total_ComboObj -= Weight_ObjFunc*config->GetdCD_dCMy()*(Surface_CMy[iMarker_Monitoring]);
17422  break;
17423  case LIFT_COEFFICIENT:
17424  Total_ComboObj+=Weight_ObjFunc*(Surface_CL[iMarker_Monitoring]);
17425  break;
17426  case SIDEFORCE_COEFFICIENT:
17427  Total_ComboObj+=Weight_ObjFunc*(Surface_CSF[iMarker_Monitoring]);
17428  break;
17429  case EFFICIENCY:
17430  Total_ComboObj+=Weight_ObjFunc*(Surface_CEff[iMarker_Monitoring]);
17431  break;
17432  case MOMENT_X_COEFFICIENT:
17433  Total_ComboObj+=Weight_ObjFunc*(Surface_CMx[iMarker_Monitoring]);
17434  if (config->GetFixed_CL_Mode()) Total_ComboObj -= Weight_ObjFunc*config->GetdCMx_dCL()*(Surface_CL[iMarker_Monitoring]);
17435  break;
17436  case MOMENT_Y_COEFFICIENT:
17437  Total_ComboObj+=Weight_ObjFunc*(Surface_CMy[iMarker_Monitoring]);
17438  if (config->GetFixed_CL_Mode()) Total_ComboObj -= Weight_ObjFunc*config->GetdCMy_dCL()*(Surface_CL[iMarker_Monitoring]);
17439  break;
17440  case MOMENT_Z_COEFFICIENT:
17441  Total_ComboObj+=Weight_ObjFunc*(Surface_CMz[iMarker_Monitoring]);
17442  if (config->GetFixed_CL_Mode()) Total_ComboObj -= Weight_ObjFunc*config->GetdCMz_dCL()*(Surface_CL[iMarker_Monitoring]);
17443  break;
17444  case FORCE_X_COEFFICIENT:
17445  Total_ComboObj+=Weight_ObjFunc*Surface_CFx[iMarker_Monitoring];
17446  break;
17447  case FORCE_Y_COEFFICIENT:
17448  Total_ComboObj+=Weight_ObjFunc*Surface_CFy[iMarker_Monitoring];
17449  break;
17450  case FORCE_Z_COEFFICIENT:
17451  Total_ComboObj+=Weight_ObjFunc*Surface_CFz[iMarker_Monitoring];
17452  break;
17453  case TOTAL_HEATFLUX:
17454  Total_ComboObj+=Weight_ObjFunc*Surface_HF_Visc[iMarker_Monitoring];
17455  break;
17456  case MAXIMUM_HEATFLUX:
17457  Total_ComboObj+=Weight_ObjFunc*Surface_MaxHF_Visc[iMarker_Monitoring];
17458  break;
17459  case BUFFET_SENSOR:
17460  Total_ComboObj +=Weight_ObjFunc*Surface_Buffet_Metric[iMarker_Monitoring];
17461  break;
17462  case BLOWING_COEFFICIENT:
17463  Total_ComboObj+=Weight_ObjFunc*Surface_Cmu[iMarker_Monitoring];
17464  break;
17465  default:
17466  break;
17467  }
17468  }
17469 
17470  /*--- The following are not per-surface, and so to avoid that they are
17471  double-counted when multiple surfaces are specified, they have been
17472  placed outside of the loop above. In addition, multi-objective mode is
17473  also disabled for these objective functions (error thrown at start). ---*/
17474 
17475  Weight_ObjFunc = config->GetWeight_ObjFunc(0);
17476  Kind_ObjFunc = config->GetKind_ObjFunc(0);
17477 
17478  switch(Kind_ObjFunc) {
17479  case EQUIVALENT_AREA:
17480  Total_ComboObj+=Weight_ObjFunc*Total_CEquivArea;
17481  break;
17482  case NEARFIELD_PRESSURE:
17483  Total_ComboObj+=Weight_ObjFunc*Total_CNearFieldOF;
17484  break;
17486  Total_ComboObj+=Weight_ObjFunc*Total_CpDiff;
17487  break;
17489  Total_ComboObj+=Weight_ObjFunc*Total_HeatFluxDiff;
17490  break;
17491  case THRUST_COEFFICIENT:
17492  Total_ComboObj+=Weight_ObjFunc*Total_CT;
17493  break;
17494  case TORQUE_COEFFICIENT:
17495  Total_ComboObj+=Weight_ObjFunc*Total_CQ;
17496  break;
17497  case FIGURE_OF_MERIT:
17498  Total_ComboObj+=Weight_ObjFunc*Total_CMerit;
17499  break;
17501  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_TotalPressure(0);
17502  break;
17504  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_Pressure(0);
17505  break;
17506  case SURFACE_MASSFLOW:
17507  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_MassFlow(0);
17508  break;
17509  case SURFACE_MACH:
17510  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_Mach(0);
17511  break;
17512  case SURFACE_UNIFORMITY:
17513  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_Uniformity(0);
17514  break;
17515  case SURFACE_SECONDARY:
17516  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_SecondaryStrength(0);
17517  break;
17519  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_MomentumDistortion(0);
17520  break;
17522  Total_ComboObj+=Weight_ObjFunc*config->GetSurface_SecondOverUniform(0);
17523  break;
17524  case CUSTOM_OBJFUNC:
17525  Total_ComboObj+=Weight_ObjFunc*Total_Custom_ObjFunc;
17526  break;
17527  default:
17528  break;
17529  }
17530 
17531 }
17532 
17533 
17534 void CNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
17535 
17536  unsigned short iDim, jDim, iVar, jVar;
17537  unsigned long iVertex, iPoint, Point_Normal, total_index;
17538 
17539  su2double Wall_HeatFlux, dist_ij, *Coord_i, *Coord_j, theta2;
17540  su2double thetax, thetay, thetaz, etax, etay, etaz, pix, piy, piz, factor;
17541  su2double ProjGridVel, *GridVel, GridVel2, *Normal, Area, Pressure = 0.0;
17542  su2double total_viscosity, div_vel, Density, tau_vel[3] = {0.0, 0.0, 0.0}, UnitNormal[3] = {0.0, 0.0, 0.0};
17543  su2double laminar_viscosity = 0.0, eddy_viscosity = 0.0, Grad_Vel[3][3] = {{0.0,0.0,0.0},{0.0,0.0,0.0},{0.0,0.0,0.0}},
17544  tau[3][3] = {{0.0,0.0,0.0},{0.0,0.0,0.0},{0.0,0.0,0.0}};
17545  su2double delta[3][3] = {{1.0, 0.0, 0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}};
17546 
17547  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
17548  bool grid_movement = config->GetGrid_Movement();
17549 
17550  /*--- Identify the boundary by string name ---*/
17551 
17552  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
17553 
17554  /*--- Get the specified wall heat flux from config as well as the
17555  wall function treatment.---*/
17556 
17557  Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag);
17558 
17559 // Wall_Function = config->GetWallFunction_Treatment(Marker_Tag);
17560 // if (Wall_Function != NO_WALL_FUNCTION) {
17561 // SU2_MPI::Error("Wall function treament not implemented yet", CURRENT_FUNCTION);
17562 // }
17563 
17564  /*--- Loop over all of the vertices on this boundary marker ---*/
17565 
17566  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
17567  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
17568 
17569  /*--- Check if the node belongs to the domain (i.e, not a halo node) ---*/
17570 
17571  if (geometry->node[iPoint]->GetDomain()) {
17572 
17573  /*--- If it is a customizable patch, retrieve the specified wall heat flux. ---*/
17574 
17575  if (config->GetMarker_All_PyCustom(val_marker)) Wall_HeatFlux = geometry->GetCustomBoundaryHeatFlux(val_marker, iVertex);
17576 
17577  /*--- Compute dual-grid area and boundary normal ---*/
17578 
17579  Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
17580 
17581  Area = 0.0;
17582  for (iDim = 0; iDim < nDim; iDim++)
17583  Area += Normal[iDim]*Normal[iDim];
17584  Area = sqrt (Area);
17585 
17586  for (iDim = 0; iDim < nDim; iDim++)
17587  UnitNormal[iDim] = -Normal[iDim]/Area;
17588 
17589  /*--- Initialize the convective & viscous residuals to zero ---*/
17590 
17591  for (iVar = 0; iVar < nVar; iVar++) {
17592  Res_Conv[iVar] = 0.0;
17593  Res_Visc[iVar] = 0.0;
17594  }
17595 
17596  /*--- Store the corrected velocity at the wall which will
17597  be zero (v = 0), unless there are moving walls (v = u_wall)---*/
17598 
17599  if (grid_movement) {
17600  GridVel = geometry->node[iPoint]->GetGridVel();
17601  for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = GridVel[iDim];
17602  } else {
17603  for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = 0.0;
17604  }
17605 
17606  /*--- Impose the value of the velocity as a strong boundary
17607  condition (Dirichlet). Fix the velocity and remove any
17608  contribution to the residual at this node. ---*/
17609 
17610  node[iPoint]->SetVelocity_Old(Vector);
17611 
17612  for (iDim = 0; iDim < nDim; iDim++)
17613  LinSysRes.SetBlock_Zero(iPoint, iDim+1);
17614  node[iPoint]->SetVel_ResTruncError_Zero();
17615 
17616  /*--- Apply a weak boundary condition for the energy equation.
17617  Compute the residual due to the prescribed heat flux. ---*/
17618 
17619  Res_Visc[nDim+1] = Wall_HeatFlux * Area;
17620 
17621  /*--- If the wall is moving, there are additional residual contributions
17622  due to pressure (p v_wall.n) and shear stress (tau.v_wall.n). ---*/
17623 
17624  if (grid_movement) {
17625 
17626  /*--- Get the grid velocity at the current boundary node ---*/
17627 
17628  GridVel = geometry->node[iPoint]->GetGridVel();
17629  ProjGridVel = 0.0;
17630  for (iDim = 0; iDim < nDim; iDim++)
17631  ProjGridVel += GridVel[iDim]*UnitNormal[iDim]*Area;
17632 
17633  /*--- Retrieve other primitive quantities and viscosities ---*/
17634 
17635  Density = node[iPoint]->GetSolution(0);
17636  Pressure = node[iPoint]->GetPressure();
17637  laminar_viscosity = node[iPoint]->GetLaminarViscosity();
17638  eddy_viscosity = node[iPoint]->GetEddyViscosity();
17639  total_viscosity = laminar_viscosity + eddy_viscosity;
17640 
17641  for (iDim = 0; iDim < nDim; iDim++) {
17642  for (jDim = 0 ; jDim < nDim; jDim++) {
17643  Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim);
17644  }
17645  }
17646 
17647  /*--- Divergence of the velocity ---*/
17648 
17649  div_vel = 0.0; for (iDim = 0 ; iDim < nDim; iDim++) div_vel += Grad_Vel[iDim][iDim];
17650 
17651  /*--- Compute the viscous stress tensor ---*/
17652 
17653  for (iDim = 0; iDim < nDim; iDim++) {
17654  for (jDim = 0; jDim < nDim; jDim++) {
17655  tau[iDim][jDim] = total_viscosity*( Grad_Vel[jDim][iDim]+Grad_Vel[iDim][jDim] ) - TWO3*total_viscosity*div_vel*delta[iDim][jDim];
17656  }
17657  }
17658 
17659  /*--- Dot product of the stress tensor with the grid velocity ---*/
17660 
17661  for (iDim = 0 ; iDim < nDim; iDim++) {
17662  tau_vel[iDim] = 0.0;
17663  for (jDim = 0 ; jDim < nDim; jDim++)
17664  tau_vel[iDim] += tau[iDim][jDim]*GridVel[jDim];
17665  }
17666 
17667  /*--- Compute the convective and viscous residuals (energy eqn.) ---*/
17668 
17669  Res_Conv[nDim+1] = Pressure*ProjGridVel;
17670  for (iDim = 0 ; iDim < nDim; iDim++)
17671  Res_Visc[nDim+1] += tau_vel[iDim]*UnitNormal[iDim]*Area;
17672 
17673  /*--- Implicit Jacobian contributions due to moving walls ---*/
17674 
17675  if (implicit) {
17676 
17677  /*--- Jacobian contribution related to the pressure term ---*/
17678 
17679  GridVel2 = 0.0;
17680  for (iDim = 0; iDim < nDim; iDim++)
17681  GridVel2 += GridVel[iDim]*GridVel[iDim];
17682  for (iVar = 0; iVar < nVar; iVar++)
17683  for (jVar = 0; jVar < nVar; jVar++)
17684  Jacobian_i[iVar][jVar] = 0.0;
17685  Jacobian_i[nDim+1][0] = 0.5*(Gamma-1.0)*GridVel2*ProjGridVel;
17686  for (jDim = 0; jDim < nDim; jDim++)
17687  Jacobian_i[nDim+1][jDim+1] = -(Gamma-1.0)*GridVel[jDim]*ProjGridVel;
17688  Jacobian_i[nDim+1][nDim+1] = (Gamma-1.0)*ProjGridVel;
17689 
17690  /*--- Add the block to the Global Jacobian structure ---*/
17691 
17692  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
17693 
17694  /*--- Now the Jacobian contribution related to the shear stress ---*/
17695 
17696  for (iVar = 0; iVar < nVar; iVar++)
17697  for (jVar = 0; jVar < nVar; jVar++)
17698  Jacobian_i[iVar][jVar] = 0.0;
17699 
17700  /*--- Compute closest normal neighbor ---*/
17701 
17702  Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
17703 
17704  /*--- Get coordinates of i & nearest normal and compute distance ---*/
17705 
17706  Coord_i = geometry->node[iPoint]->GetCoord();
17707  Coord_j = geometry->node[Point_Normal]->GetCoord();
17708 
17709  dist_ij = 0;
17710  for (iDim = 0; iDim < nDim; iDim++)
17711  dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
17712  dist_ij = sqrt(dist_ij);
17713 
17714  theta2 = 0.0;
17715  for (iDim = 0; iDim < nDim; iDim++)
17716  theta2 += UnitNormal[iDim]*UnitNormal[iDim];
17717 
17718  factor = total_viscosity*Area/(Density*dist_ij);
17719 
17720  if (nDim == 2) {
17721  thetax = theta2 + UnitNormal[0]*UnitNormal[0]/3.0;
17722  thetay = theta2 + UnitNormal[1]*UnitNormal[1]/3.0;
17723 
17724  etaz = UnitNormal[0]*UnitNormal[1]/3.0;
17725 
17726  pix = GridVel[0]*thetax + GridVel[1]*etaz;
17727  piy = GridVel[0]*etaz + GridVel[1]*thetay;
17728 
17729  Jacobian_i[nDim+1][0] -= factor*(-pix*GridVel[0]+piy*GridVel[1]);
17730  Jacobian_i[nDim+1][1] -= factor*pix;
17731  Jacobian_i[nDim+1][2] -= factor*piy;
17732  } else {
17733  thetax = theta2 + UnitNormal[0]*UnitNormal[0]/3.0;
17734  thetay = theta2 + UnitNormal[1]*UnitNormal[1]/3.0;
17735  thetaz = theta2 + UnitNormal[2]*UnitNormal[2]/3.0;
17736 
17737  etaz = UnitNormal[0]*UnitNormal[1]/3.0;
17738  etax = UnitNormal[1]*UnitNormal[2]/3.0;
17739  etay = UnitNormal[0]*UnitNormal[2]/3.0;
17740 
17741  pix = GridVel[0]*thetax + GridVel[1]*etaz + GridVel[2]*etay;
17742  piy = GridVel[0]*etaz + GridVel[1]*thetay + GridVel[2]*etax;
17743  piz = GridVel[0]*etay + GridVel[1]*etax + GridVel[2]*thetaz;
17744 
17745  Jacobian_i[nDim+1][0] -= factor*(-pix*GridVel[0]+piy*GridVel[1]+piz*GridVel[2]);
17746  Jacobian_i[nDim+1][1] -= factor*pix;
17747  Jacobian_i[nDim+1][2] -= factor*piy;
17748  Jacobian_i[nDim+1][3] -= factor*piz;
17749  }
17750 
17751  /*--- Subtract the block from the Global Jacobian structure ---*/
17752 
17753  Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
17754 
17755  }
17756  }
17757 
17758  /*--- Convective contribution to the residual at the wall ---*/
17759 
17760  LinSysRes.AddBlock(iPoint, Res_Conv);
17761 
17762  /*--- Viscous contribution to the residual at the wall ---*/
17763 
17764  LinSysRes.SubtractBlock(iPoint, Res_Visc);
17765 
17766  /*--- Enforce the no-slip boundary condition in a strong way by
17767  modifying the velocity-rows of the Jacobian (1 on the diagonal). ---*/
17768 
17769  if (implicit) {
17770  for (iVar = 1; iVar <= nDim; iVar++) {
17771  total_index = iPoint*nVar+iVar;
17772  Jacobian.DeleteValsRowi(total_index);
17773  }
17774  }
17775 
17776  }
17777  }
17778 }
17779 
17780 void CNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
17781 
17782  unsigned short iVar, jVar, iDim, jDim;
17783  unsigned long iVertex, iPoint, Point_Normal, total_index;
17784 
17785  su2double *Normal, *Coord_i, *Coord_j, Area, dist_ij, theta2;
17786  su2double Twall, dTdn, dTdrho, thermal_conductivity;
17787  su2double thetax, thetay, thetaz, etax, etay, etaz, pix, piy, piz, factor;
17788  su2double ProjGridVel, *GridVel, GridVel2, Pressure = 0.0, Density, Vel2;
17789  su2double total_viscosity, div_vel, tau_vel[3] = {0.0,0.0,0.0}, UnitNormal[3] = {0.0,0.0,0.0};
17790  su2double laminar_viscosity, eddy_viscosity, Grad_Vel[3][3] = {{1.0, 0.0, 0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}},
17791  tau[3][3] = {{0.0, 0.0, 0.0},{0.0,0.0,0.0},{0.0,0.0,0.0}}, delta[3][3] = {{1.0, 0.0, 0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}};
17792 
17793  su2double Prandtl_Lam = config->GetPrandtl_Lam();
17794  su2double Prandtl_Turb = config->GetPrandtl_Turb();
17795  su2double Gas_Constant = config->GetGas_ConstantND();
17796  su2double Cp = (Gamma / Gamma_Minus_One) * Gas_Constant;
17797 
17798  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
17799  bool grid_movement = config->GetGrid_Movement();
17800 
17801  /*--- Identify the boundary ---*/
17802 
17803  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
17804 
17805  /*--- Retrieve the specified wall temperature from config
17806  as well as the wall function treatment.---*/
17807 
17808  Twall = config->GetIsothermal_Temperature(Marker_Tag)/config->GetTemperature_Ref();
17809 
17810 // Wall_Function = config->GetWallFunction_Treatment(Marker_Tag);
17811 // if (Wall_Function != NO_WALL_FUNCTION) {
17812 // SU2_MPI::Error("Wall function treament not implemented yet", CURRENT_FUNCTION);
17813 // }
17814 
17815  /*--- Loop over boundary points ---*/
17816 
17817  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
17818 
17819  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
17820 
17821  if (geometry->node[iPoint]->GetDomain()) {
17822 
17823  /*--- If it is a customizable patch, retrieve the specified wall temperature. ---*/
17824 
17825  if (config->GetMarker_All_PyCustom(val_marker)) Twall = geometry->GetCustomBoundaryTemperature(val_marker, iVertex);
17826 
17827  /*--- Compute dual-grid area and boundary normal ---*/
17828 
17829  Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
17830 
17831  Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt (Area);
17832 
17833  for (iDim = 0; iDim < nDim; iDim++)
17834  UnitNormal[iDim] = -Normal[iDim]/Area;
17835 
17836  /*--- Calculate useful quantities ---*/
17837 
17838  theta2 = 0.0;
17839  for (iDim = 0; iDim < nDim; iDim++)
17840  theta2 += UnitNormal[iDim]*UnitNormal[iDim];
17841 
17842  /*--- Compute closest normal neighbor ---*/
17843 
17844  Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
17845 
17846  /*--- Get coordinates of i & nearest normal and compute distance ---*/
17847 
17848  Coord_i = geometry->node[iPoint]->GetCoord();
17849  Coord_j = geometry->node[Point_Normal]->GetCoord();
17850  dist_ij = 0;
17851  for (iDim = 0; iDim < nDim; iDim++)
17852  dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
17853  dist_ij = sqrt(dist_ij);
17854 
17855  /*--- Store the corrected velocity at the wall which will
17856  be zero (v = 0), unless there is grid motion (v = u_wall)---*/
17857 
17858  if (grid_movement) {
17859  GridVel = geometry->node[iPoint]->GetGridVel();
17860  for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = GridVel[iDim];
17861  }
17862  else {
17863  for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = 0.0;
17864  }
17865 
17866  /*--- Initialize the convective & viscous residuals to zero ---*/
17867 
17868  for (iVar = 0; iVar < nVar; iVar++) {
17869  Res_Conv[iVar] = 0.0;
17870  Res_Visc[iVar] = 0.0;
17871  }
17872 
17873  /*--- Set the residual, truncation error and velocity value on the boundary ---*/
17874 
17875  node[iPoint]->SetVelocity_Old(Vector);
17876 
17877  for (iDim = 0; iDim < nDim; iDim++)
17878  LinSysRes.SetBlock_Zero(iPoint, iDim+1);
17879  node[iPoint]->SetVel_ResTruncError_Zero();
17880 
17881  /*--- Compute the normal gradient in temperature using Twall ---*/
17882 
17883  dTdn = -(node[Point_Normal]->GetPrimitive(0) - Twall)/dist_ij;
17884 
17885  /*--- Get transport coefficients ---*/
17886 
17887  laminar_viscosity = node[iPoint]->GetLaminarViscosity();
17888  eddy_viscosity = node[iPoint]->GetEddyViscosity();
17889  thermal_conductivity = Cp * ( laminar_viscosity/Prandtl_Lam + eddy_viscosity/Prandtl_Turb);
17890 
17891  // work in progress on real-gases...
17892  //thermal_conductivity = node[iPoint]->GetThermalConductivity();
17893  //Cp = node[iPoint]->GetSpecificHeatCp();
17894  //thermal_conductivity += Cp*eddy_viscosity/Prandtl_Turb;
17895 
17896  /*--- Apply a weak boundary condition for the energy equation.
17897  Compute the residual due to the prescribed heat flux. ---*/
17898 
17899  Res_Visc[nDim+1] = thermal_conductivity * dTdn * Area;
17900 
17901  /*--- Calculate Jacobian for implicit time stepping ---*/
17902 
17903  if (implicit) {
17904 
17905  for (iVar = 0; iVar < nVar; iVar ++)
17906  for (jVar = 0; jVar < nVar; jVar ++)
17907  Jacobian_i[iVar][jVar] = 0.0;
17908 
17909  /*--- Calculate useful quantities ---*/
17910 
17911  Density = node[iPoint]->GetPrimitive(nDim+2);
17912  Vel2 = 0.0;
17913  for (iDim = 0; iDim < nDim; iDim++)
17914  Vel2 += node[iPoint]->GetPrimitive(iDim+1) * node[iPoint]->GetPrimitive(iDim+1);
17915  dTdrho = 1.0/Density * ( -Twall + (Gamma-1.0)/Gas_Constant*(Vel2/2.0) );
17916 
17917  /*--- Enforce the no-slip boundary condition in a strong way ---*/
17918 
17919  for (iVar = 1; iVar <= nDim; iVar++) {
17920  total_index = iPoint*nVar+iVar;
17921  Jacobian.DeleteValsRowi(total_index);
17922  }
17923 
17924  /*--- Add contributions to the Jacobian from the weak enforcement of the energy equations ---*/
17925 
17926  Jacobian_i[nDim+1][0] = -thermal_conductivity*theta2/dist_ij * dTdrho * Area;
17927  Jacobian_i[nDim+1][nDim+1] = -thermal_conductivity*theta2/dist_ij * (Gamma-1.0)/(Gas_Constant*Density) * Area;
17928 
17929  /*--- Subtract the block from the Global Jacobian structure ---*/
17930 
17931  Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
17932 
17933  }
17934 
17935  /*--- If the wall is moving, there are additional residual contributions
17936  due to pressure (p v_wall.n) and shear stress (tau.v_wall.n). ---*/
17937 
17938  if (grid_movement) {
17939 
17940  /*--- Get the grid velocity at the current boundary node ---*/
17941 
17942  GridVel = geometry->node[iPoint]->GetGridVel();
17943  ProjGridVel = 0.0;
17944  for (iDim = 0; iDim < nDim; iDim++)
17945  ProjGridVel += GridVel[iDim]*UnitNormal[iDim]*Area;
17946 
17947  /*--- Retrieve other primitive quantities and viscosities ---*/
17948 
17949  Density = node[iPoint]->GetSolution(0);
17950  Pressure = node[iPoint]->GetPressure();
17951  laminar_viscosity = node[iPoint]->GetLaminarViscosity();
17952  eddy_viscosity = node[iPoint]->GetEddyViscosity();
17953 
17954  total_viscosity = laminar_viscosity + eddy_viscosity;
17955 
17956  for (iDim = 0; iDim < nDim; iDim++) {
17957  for (jDim = 0 ; jDim < nDim; jDim++) {
17958  Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim);
17959  }
17960  }
17961 
17962  /*--- Divergence of the velocity ---*/
17963 
17964  div_vel = 0.0; for (iDim = 0 ; iDim < nDim; iDim++) div_vel += Grad_Vel[iDim][iDim];
17965 
17966  /*--- Compute the viscous stress tensor ---*/
17967 
17968  for (iDim = 0; iDim < nDim; iDim++)
17969  for (jDim = 0; jDim < nDim; jDim++) {
17970  tau[iDim][jDim] = total_viscosity*( Grad_Vel[jDim][iDim] + Grad_Vel[iDim][jDim] ) - TWO3*total_viscosity*div_vel*delta[iDim][jDim];
17971  }
17972 
17973  /*--- Dot product of the stress tensor with the grid velocity ---*/
17974 
17975  for (iDim = 0 ; iDim < nDim; iDim++) {
17976  tau_vel[iDim] = 0.0;
17977  for (jDim = 0 ; jDim < nDim; jDim++)
17978  tau_vel[iDim] += tau[iDim][jDim]*GridVel[jDim];
17979  }
17980 
17981  /*--- Compute the convective and viscous residuals (energy eqn.) ---*/
17982 
17983  Res_Conv[nDim+1] = Pressure*ProjGridVel;
17984  for (iDim = 0 ; iDim < nDim; iDim++)
17985  Res_Visc[nDim+1] += tau_vel[iDim]*UnitNormal[iDim]*Area;
17986 
17987  /*--- Implicit Jacobian contributions due to moving walls ---*/
17988 
17989  if (implicit) {
17990 
17991  /*--- Jacobian contribution related to the pressure term ---*/
17992 
17993  GridVel2 = 0.0;
17994  for (iDim = 0; iDim < nDim; iDim++)
17995  GridVel2 += GridVel[iDim]*GridVel[iDim];
17996  for (iVar = 0; iVar < nVar; iVar++)
17997  for (jVar = 0; jVar < nVar; jVar++)
17998  Jacobian_i[iVar][jVar] = 0.0;
17999 
18000  Jacobian_i[nDim+1][0] = 0.5*(Gamma-1.0)*GridVel2*ProjGridVel;
18001  for (jDim = 0; jDim < nDim; jDim++)
18002  Jacobian_i[nDim+1][jDim+1] = -(Gamma-1.0)*GridVel[jDim]*ProjGridVel;
18003  Jacobian_i[nDim+1][nDim+1] = (Gamma-1.0)*ProjGridVel;
18004 
18005  /*--- Add the block to the Global Jacobian structure ---*/
18006 
18007  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
18008 
18009  /*--- Now the Jacobian contribution related to the shear stress ---*/
18010 
18011  for (iVar = 0; iVar < nVar; iVar++)
18012  for (jVar = 0; jVar < nVar; jVar++)
18013  Jacobian_i[iVar][jVar] = 0.0;
18014 
18015  factor = total_viscosity*Area/(Density*dist_ij);
18016 
18017  if (nDim == 2) {
18018  thetax = theta2 + UnitNormal[0]*UnitNormal[0]/3.0;
18019  thetay = theta2 + UnitNormal[1]*UnitNormal[1]/3.0;
18020 
18021  etaz = UnitNormal[0]*UnitNormal[1]/3.0;
18022 
18023  pix = GridVel[0]*thetax + GridVel[1]*etaz;
18024  piy = GridVel[0]*etaz + GridVel[1]*thetay;
18025 
18026  Jacobian_i[nDim+1][0] -= factor*(-pix*GridVel[0]+piy*GridVel[1]);
18027  Jacobian_i[nDim+1][1] -= factor*pix;
18028  Jacobian_i[nDim+1][2] -= factor*piy;
18029  }
18030  else {
18031  thetax = theta2 + UnitNormal[0]*UnitNormal[0]/3.0;
18032  thetay = theta2 + UnitNormal[1]*UnitNormal[1]/3.0;
18033  thetaz = theta2 + UnitNormal[2]*UnitNormal[2]/3.0;
18034 
18035  etaz = UnitNormal[0]*UnitNormal[1]/3.0;
18036  etax = UnitNormal[1]*UnitNormal[2]/3.0;
18037  etay = UnitNormal[0]*UnitNormal[2]/3.0;
18038 
18039  pix = GridVel[0]*thetax + GridVel[1]*etaz + GridVel[2]*etay;
18040  piy = GridVel[0]*etaz + GridVel[1]*thetay + GridVel[2]*etax;
18041  piz = GridVel[0]*etay + GridVel[1]*etax + GridVel[2]*thetaz;
18042 
18043  Jacobian_i[nDim+1][0] -= factor*(-pix*GridVel[0]+piy*GridVel[1]+piz*GridVel[2]);
18044  Jacobian_i[nDim+1][1] -= factor*pix;
18045  Jacobian_i[nDim+1][2] -= factor*piy;
18046  Jacobian_i[nDim+1][3] -= factor*piz;
18047  }
18048 
18049  /*--- Subtract the block from the Global Jacobian structure ---*/
18050 
18051  Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
18052  }
18053 
18054  }
18055 
18056  /*--- Convective contribution to the residual at the wall ---*/
18057 
18058  LinSysRes.AddBlock(iPoint, Res_Conv);
18059 
18060  /*--- Viscous contribution to the residual at the wall ---*/
18061 
18062  LinSysRes.SubtractBlock(iPoint, Res_Visc);
18063 
18064  /*--- Enforce the no-slip boundary condition in a strong way by
18065  modifying the velocity-rows of the Jacobian (1 on the diagonal). ---*/
18066 
18067  if (implicit) {
18068  for (iVar = 1; iVar <= nDim; iVar++) {
18069  total_index = iPoint*nVar+iVar;
18070  Jacobian.DeleteValsRowi(total_index);
18071  }
18072  }
18073 
18074  }
18075  }
18076 }
18077 
18079 
18080  unsigned long iPoint;
18081  su2double wall_distance;
18082 
18083  unsigned short kind_roe_dissipation = config->GetKind_RoeLowDiss();
18084 
18085  for (iPoint = 0; iPoint < nPoint; iPoint++){
18086 
18087  if (kind_roe_dissipation == FD || kind_roe_dissipation == FD_DUCROS){
18088  if (config->GetKind_HybridRANSLES() == NO_HYBRIDRANSLES){
18089  wall_distance = geometry->node[iPoint]->GetWall_Distance();
18090  } else {
18091  wall_distance = node[iPoint]->GetDES_LengthScale();
18092  }
18093 
18094  node[iPoint]->SetRoe_Dissipation_FD(wall_distance);
18095 
18096  } else if (kind_roe_dissipation == NTS || kind_roe_dissipation == NTS_DUCROS) {
18097 
18098  const su2double delta = geometry->node[iPoint]->GetMaxLength();
18099  assert(delta > 0); // Delta must be initialized and non-negative
18100  node[iPoint]->SetRoe_Dissipation_NTS(delta, config->GetConst_DES());
18101  }
18102  }
18103 }
18104 
18105 void CNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CConfig *config, unsigned short val_marker) {
18106 
18107  unsigned short iVar, jVar, iDim, jDim;
18108  unsigned long iVertex, iPoint, Point_Normal, total_index;
18109 
18110  su2double *Normal, *Coord_i, *Coord_j, Area, dist_ij, theta2;
18111  su2double Twall, There, dTdn, dTdrho, thermal_conductivity, Tconjugate, HF_FactorHere, HF_FactorConjugate;
18112  su2double thetax, thetay, thetaz, etax, etay, etaz, pix, piy, piz, factor;
18113  su2double ProjGridVel, *GridVel, GridVel2, Pressure = 0.0, Density, Vel2;
18114  su2double total_viscosity, div_vel, tau_vel[3] = {0.0,0.0,0.0}, UnitNormal[3] = {0.0,0.0,0.0};
18115  su2double laminar_viscosity, eddy_viscosity, Grad_Vel[3][3] = {{1.0, 0.0, 0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}},
18116  tau[3][3] = {{0.0, 0.0, 0.0},{0.0,0.0,0.0},{0.0,0.0,0.0}}, delta[3][3] = {{1.0, 0.0, 0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}};
18117 
18118  su2double Prandtl_Lam = config->GetPrandtl_Lam();
18119  su2double Prandtl_Turb = config->GetPrandtl_Turb();
18120  su2double Gas_Constant = config->GetGas_ConstantND();
18121  su2double Cp = (Gamma / Gamma_Minus_One) * Gas_Constant;
18122 
18123  bool implicit = (config->GetKind_TimeIntScheme_Flow() == EULER_IMPLICIT);
18124  bool grid_movement = config->GetGrid_Movement();
18125 
18126  /*--- Identify the boundary ---*/
18127 
18128  string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
18129 
18130 // /*--- Retrieve the specified wall function treatment.---*/
18131 //
18132 // Wall_Function = config->GetWallFunction_Treatment(Marker_Tag);
18133 // if (Wall_Function != NO_WALL_FUNCTION) {
18134 // SU2_MPI::Error("Wall function treament not implemented yet", CURRENT_FUNCTION);
18135 // }
18136 
18137  /*--- Loop over boundary points ---*/
18138 
18139  for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) {
18140 
18141  iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
18142 
18143  if (geometry->node[iPoint]->GetDomain()) {
18144 
18145  /*--- Compute dual-grid area and boundary normal ---*/
18146 
18147  Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
18148 
18149  Area = 0.0; for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt (Area);
18150 
18151  for (iDim = 0; iDim < nDim; iDim++)
18152  UnitNormal[iDim] = -Normal[iDim]/Area;
18153 
18154  /*--- Calculate useful quantities ---*/
18155 
18156  theta2 = 0.0;
18157  for (iDim = 0; iDim < nDim; iDim++)
18158  theta2 += UnitNormal[iDim]*UnitNormal[iDim];
18159 
18160  /*--- Compute closest normal neighbor ---*/
18161 
18162  Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
18163 
18164  /*--- Get coordinates of i & nearest normal and compute distance ---*/
18165 
18166  Coord_i = geometry->node[iPoint]->GetCoord();
18167  Coord_j = geometry->node[Point_Normal]->GetCoord();
18168  dist_ij = 0;
18169  for (iDim = 0; iDim < nDim; iDim++)
18170  dist_ij += (Coord_j[iDim]-Coord_i[iDim])*(Coord_j[iDim]-Coord_i[iDim]);
18171  dist_ij = sqrt(dist_ij);
18172 
18173  /*--- Store the corrected velocity at the wall which will
18174  be zero (v = 0), unless there is grid motion (v = u_wall)---*/
18175 
18176  if (grid_movement) {
18177  GridVel = geometry->node[iPoint]->GetGridVel();
18178  for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = GridVel[iDim];
18179  }
18180  else {
18181  for (iDim = 0; iDim < nDim; iDim++) Vector[iDim] = 0.0;
18182  }
18183 
18184  /*--- Initialize the convective & viscous residuals to zero ---*/
18185 
18186  for (iVar = 0; iVar < nVar; iVar++) {
18187  Res_Conv[iVar] = 0.0;
18188  Res_Visc[iVar] = 0.0;
18189  }
18190 
18191  /*--- Set the residual, truncation error and velocity value on the boundary ---*/
18192 
18193  node[iPoint]->SetVelocity_Old(Vector);
18194 
18195  for (iDim = 0; iDim < nDim; iDim++)
18196  LinSysRes.SetBlock_Zero(iPoint, iDim+1);
18197  node[iPoint]->SetVel_ResTruncError_Zero();
18198 
18199  /*--- Get transport coefficients ---*/
18200 
18201  laminar_viscosity = node[iPoint]->GetLaminarViscosity();
18202  eddy_viscosity = node[iPoint]->GetEddyViscosity();
18203  thermal_conductivity = Cp * ( laminar_viscosity/Prandtl_Lam + eddy_viscosity/Prandtl_Turb);
18204 
18205  // work in progress on real-gases...
18206  //thermal_conductivity = node[iPoint]->GetThermalConductivity();
18207  //Cp = node[iPoint]->GetSpecificHeatCp();
18208  //thermal_conductivity += Cp*eddy_viscosity/Prandtl_Turb;
18209 
18210  /*--- Compute the normal gradient in temperature using Twall ---*/
18211 
18212  There = node[Point_Normal]->GetPrimitive(0);
18213  Tconjugate = GetConjugateHeatVariable(val_marker, iVertex, 0);
18214 
18215  HF_FactorHere = thermal_conductivity*config->GetViscosity_Ref()/dist_ij;
18216  HF_FactorConjugate = GetConjugateHeatVariable(val_marker, iVertex, 2);
18217 
18218  Twall = (There*HF_FactorHere + Tconjugate*HF_FactorConjugate)/(HF_FactorHere + HF_FactorConjugate);
18219 
18220  // this will be changed soon...
18221  Twall = GetConjugateHeatVariable(val_marker, iVertex, 0);
18222 
18223  dTdn = -(node[Point_Normal]->GetPrimitive(0) - Twall)/dist_ij;
18224 
18225  /*--- Apply a weak boundary condition for the energy equation.
18226  Compute the residual due to the prescribed heat flux. ---*/
18227 
18228  Res_Visc[nDim+1] = thermal_conductivity * dTdn * Area;
18229 
18230  /*--- Calculate Jacobian for implicit time stepping ---*/
18231 
18232  if (implicit) {
18233 
18234  for (iVar = 0; iVar < nVar; iVar ++)
18235  for (jVar = 0; jVar < nVar; jVar ++)
18236  Jacobian_i[iVar][jVar] = 0.0;
18237 
18238  /*--- Calculate useful quantities ---*/
18239 
18240  Density = node[iPoint]->GetPrimitive(nDim+2);
18241  Vel2 = 0.0;
18242  for (iDim = 0; iDim < nDim; iDim++)
18243  Vel2 += node[iPoint]->GetPrimitive(iDim+1) * node[iPoint]->GetPrimitive(iDim+1);
18244  dTdrho = 1.0/Density * ( -Twall + (Gamma-1.0)/Gas_Constant*(Vel2/2.0) );
18245 
18246  /*--- Enforce the no-slip boundary condition in a strong way ---*/
18247 
18248  for (iVar = 1; iVar <= nDim; iVar++) {
18249  total_index = iPoint*nVar+iVar;
18250  Jacobian.DeleteValsRowi(total_index);
18251  }
18252 
18253  /*--- Add contributions to the Jacobian from the weak enforcement of the energy equations ---*/
18254 
18255  Jacobian_i[nDim+1][0] = -thermal_conductivity*theta2/dist_ij * dTdrho * Area;
18256  Jacobian_i[nDim+1][nDim+1] = -thermal_conductivity*theta2/dist_ij * (Gamma-1.0)/(Gas_Constant*Density) * Area;
18257 
18258  /*--- Subtract the block from the Global Jacobian structure ---*/
18259 
18260  Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
18261 
18262  }
18263 
18264  /*--- If the wall is moving, there are additional residual contributions
18265  due to pressure (p v_wall.n) and shear stress (tau.v_wall.n). ---*/
18266 
18267  if (grid_movement) {
18268 
18269  /*--- Get the grid velocity at the current boundary node ---*/
18270 
18271  GridVel = geometry->node[iPoint]->GetGridVel();
18272  ProjGridVel = 0.0;
18273  for (iDim = 0; iDim < nDim; iDim++)
18274  ProjGridVel += GridVel[iDim]*UnitNormal[iDim]*Area;
18275 
18276  /*--- Retrieve other primitive quantities and viscosities ---*/
18277 
18278  Density = node[iPoint]->GetSolution(0);
18279  Pressure = node[iPoint]->GetPressure();
18280  laminar_viscosity = node[iPoint]->GetLaminarViscosity();
18281  eddy_viscosity = node[iPoint]->GetEddyViscosity();
18282 
18283  total_viscosity = laminar_viscosity + eddy_viscosity;
18284 
18285  for (iDim = 0; iDim < nDim; iDim++) {
18286  for (jDim = 0 ; jDim < nDim; jDim++) {
18287  Grad_Vel[iDim][jDim] = node[iPoint]->GetGradient_Primitive(iDim+1, jDim);
18288  }
18289  }
18290 
18291  /*--- Divergence of the velocity ---*/
18292 
18293  div_vel = 0.0; for (iDim = 0 ; iDim < nDim; iDim++) div_vel += Grad_Vel[iDim][iDim];
18294 
18295  /*--- Compute the viscous stress tensor ---*/
18296 
18297  for (iDim = 0; iDim < nDim; iDim++)
18298  for (jDim = 0; jDim < nDim; jDim++) {
18299  tau[iDim][jDim] = total_viscosity*( Grad_Vel[jDim][iDim] + Grad_Vel[iDim][jDim] ) - TWO3*total_viscosity*div_vel*delta[iDim][jDim];
18300  }
18301 
18302  /*--- Dot product of the stress tensor with the grid velocity ---*/
18303 
18304  for (iDim = 0 ; iDim < nDim; iDim++) {
18305  tau_vel[iDim] = 0.0;
18306  for (jDim = 0 ; jDim < nDim; jDim++)
18307  tau_vel[iDim] += tau[iDim][jDim]*GridVel[jDim];
18308  }
18309 
18310  /*--- Compute the convective and viscous residuals (energy eqn.) ---*/
18311 
18312  Res_Conv[nDim+1] = Pressure*ProjGridVel;
18313  for (iDim = 0 ; iDim < nDim; iDim++)
18314  Res_Visc[nDim+1] += tau_vel[iDim]*UnitNormal[iDim]*Area;
18315 
18316  /*--- Implicit Jacobian contributions due to moving walls ---*/
18317 
18318  if (implicit) {
18319 
18320  /*--- Jacobian contribution related to the pressure term ---*/
18321 
18322  GridVel2 = 0.0;
18323  for (iDim = 0; iDim < nDim; iDim++)
18324  GridVel2 += GridVel[iDim]*GridVel[iDim];
18325  for (iVar = 0; iVar < nVar; iVar++)
18326  for (jVar = 0; jVar < nVar; jVar++)
18327  Jacobian_i[iVar][jVar] = 0.0;
18328 
18329  Jacobian_i[nDim+1][0] = 0.5*(Gamma-1.0)*GridVel2*ProjGridVel;
18330  for (jDim = 0; jDim < nDim; jDim++)
18331  Jacobian_i[nDim+1][jDim+1] = -(Gamma-1.0)*GridVel[jDim]*ProjGridVel;
18332  Jacobian_i[nDim+1][nDim+1] = (Gamma-1.0)*ProjGridVel;
18333 
18334  /*--- Add the block to the Global Jacobian structure ---*/
18335 
18336  Jacobian.AddBlock(iPoint, iPoint, Jacobian_i);
18337 
18338  /*--- Now the Jacobian contribution related to the shear stress ---*/
18339 
18340  for (iVar = 0; iVar < nVar; iVar++)
18341  for (jVar = 0; jVar < nVar; jVar++)
18342  Jacobian_i[iVar][jVar] = 0.0;
18343 
18344  factor = total_viscosity*Area/(Density*dist_ij);
18345 
18346  if (nDim == 2) {
18347  thetax = theta2 + UnitNormal[0]*UnitNormal[0]/3.0;
18348  thetay = theta2 + UnitNormal[1]*UnitNormal[1]/3.0;
18349 
18350  etaz = UnitNormal[0]*UnitNormal[1]/3.0;
18351 
18352  pix = GridVel[0]*thetax + GridVel[1]*etaz;
18353  piy = GridVel[0]*etaz + GridVel[1]*thetay;
18354 
18355  Jacobian_i[nDim+1][0] -= factor*(-pix*GridVel[0]+piy*GridVel[1]);
18356  Jacobian_i[nDim+1][1] -= factor*pix;
18357  Jacobian_i[nDim+1][2] -= factor*piy;
18358  }
18359  else {
18360  thetax = theta2 + UnitNormal[0]*UnitNormal[0]/3.0;
18361  thetay = theta2 + UnitNormal[1]*UnitNormal[1]/3.0;
18362  thetaz = theta2 + UnitNormal[2]*UnitNormal[2]/3.0;
18363 
18364  etaz = UnitNormal[0]*UnitNormal[1]/3.0;
18365  etax = UnitNormal[1]*UnitNormal[2]/3.0;
18366  etay = UnitNormal[0]*UnitNormal[2]/3.0;
18367 
18368  pix = GridVel[0]*thetax + GridVel[1]*etaz + GridVel[2]*etay;
18369  piy = GridVel[0]*etaz + GridVel[1]*thetay + GridVel[2]*etax;
18370  piz = GridVel[0]*etay + GridVel[1]*etax + GridVel[2]*thetaz;
18371 
18372  Jacobian_i[nDim+1][0] -= factor*(-pix*GridVel[0]+piy*GridVel[1]+piz*GridVel[2]);
18373  Jacobian_i[nDim+1][1] -= factor*pix;
18374  Jacobian_i[nDim+1][2] -= factor*piy;
18375  Jacobian_i[nDim+1][3] -= factor*piz;
18376  }
18377 
18378  /*--- Subtract the block from the Global Jacobian structure ---*/
18379 
18380  Jacobian.SubtractBlock(iPoint, iPoint, Jacobian_i);
18381  }
18382 
18383  }
18384 
18385  /*--- Convective contribution to the residual at the wall ---*/
18386 
18387  LinSysRes.AddBlock(iPoint, Res_Conv);
18388 
18389  /*--- Viscous contribution to the residual at the wall ---*/
18390 
18391  LinSysRes.SubtractBlock(iPoint, Res_Visc);
18392 
18393  /*--- Enforce the no-slip boundary condition in a strong way by
18394  modifying the velocity-rows of the Jacobian (1 on the diagonal). ---*/
18395 
18396  if (implicit) {
18397  for (iVar = 1; iVar <= nDim; iVar++) {
18398  total_index = iPoint*nVar+iVar;
18399  Jacobian.DeleteValsRowi(total_index);
18400  }
18401  }
18402 
18403  }
18404  }
18405 }
18406 
18407 void CNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container, CConfig *config) {
18408 
18409  unsigned short iDim, jDim, iMarker;
18410  unsigned long iVertex, iPoint, Point_Normal, counter;
18411 
18412  su2double Area, div_vel, UnitNormal[3], *Normal;
18413  su2double **grad_primvar, tau[3][3];
18414 
18415  su2double Vel[3], VelNormal, VelTang[3], VelTangMod, VelInfMod, WallDist[3], WallDistMod;
18416  su2double T_Normal, P_Normal;
18417  su2double Density_Wall, T_Wall, P_Wall, Lam_Visc_Wall, Tau_Wall = 0.0, Tau_Wall_Old = 0.0;
18418  su2double *Coord, *Coord_Normal;
18419  su2double diff, Delta;
18420  su2double U_Tau, U_Plus, Gam, Beta, Phi, Q, Y_Plus_White, Y_Plus;
18421  su2double TauElem[3], TauNormal, TauTangent[3], WallShearStress;
18422  su2double Gas_Constant = config->GetGas_ConstantND();
18423  su2double Cp = (Gamma / Gamma_Minus_One) * Gas_Constant;
18424 
18425  unsigned short max_iter = 10;
18426  su2double tol = 1e-6;
18427 
18428  /*--- Get the freestream velocity magnitude for non-dim. purposes ---*/
18429 
18430  su2double *VelInf = config->GetVelocity_FreeStreamND();
18431  VelInfMod = 0.0;
18432  for (iDim = 0; iDim < nDim; iDim++)
18433  VelInfMod += VelInf[iDim];
18434  VelInfMod = sqrt(VelInfMod);
18435 
18436  /*--- Compute the recovery factor ---*/
18437  // Double-check: laminar or turbulent Pr for this?
18438  su2double Recovery = pow(config->GetPrandtl_Lam(), (1.0/3.0));
18439 
18440  /*--- Typical constants from boundary layer theory ---*/
18441 
18442  su2double kappa = 0.4;
18443  su2double B = 5.5;
18444 
18445  for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
18446 
18447  if ((config->GetMarker_All_KindBC(iMarker) == HEAT_FLUX) ||
18448  (config->GetMarker_All_KindBC(iMarker) == ISOTHERMAL) ) {
18449 
18450  /*--- Identify the boundary by string name ---*/
18451 
18452  string Marker_Tag = config->GetMarker_All_TagBound(iMarker);
18453 
18454  /*--- Get the specified wall heat flux from config ---*/
18455 
18456  // Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag);
18457 
18458  /*--- Loop over all of the vertices on this boundary marker ---*/
18459 
18460  for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
18461 
18462  iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
18463  Point_Normal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
18464 
18465  /*--- Check if the node belongs to the domain (i.e, not a halo node)
18466  and the neighbor is not part of the physical boundary ---*/
18467 
18468  if (geometry->node[iPoint]->GetDomain()) {
18469 
18470  /*--- Get coordinates of the current vertex and nearest normal point ---*/
18471 
18472  Coord = geometry->node[iPoint]->GetCoord();
18473  Coord_Normal = geometry->node[Point_Normal]->GetCoord();
18474 
18475  /*--- Compute dual-grid area and boundary normal ---*/
18476 
18477  Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
18478 
18479  Area = 0.0;
18480  for (iDim = 0; iDim < nDim; iDim++)
18481  Area += Normal[iDim]*Normal[iDim];
18482  Area = sqrt (Area);
18483 
18484  for (iDim = 0; iDim < nDim; iDim++)
18485  UnitNormal[iDim] = -Normal[iDim]/Area;
18486 
18487  /*--- Get the velocity, pressure, and temperature at the nearest
18488  (normal) interior point. ---*/
18489 
18490  for (iDim = 0; iDim < nDim; iDim++)
18491  Vel[iDim] = node[Point_Normal]->GetVelocity(iDim);
18492  P_Normal = node[Point_Normal]->GetPressure();
18493  T_Normal = node[Point_Normal]->GetTemperature();
18494 
18495  /*--- Compute the wall-parallel velocity at first point off the wall ---*/
18496 
18497  VelNormal = 0.0;
18498  for (iDim = 0; iDim < nDim; iDim++)
18499  VelNormal += Vel[iDim] * UnitNormal[iDim];
18500  for (iDim = 0; iDim < nDim; iDim++)
18501  VelTang[iDim] = Vel[iDim] - VelNormal*UnitNormal[iDim];
18502 
18503  VelTangMod = 0.0;
18504  for (iDim = 0; iDim < nDim; iDim++)
18505  VelTangMod += VelTang[iDim]*VelTang[iDim];
18506  VelTangMod = sqrt(VelTangMod);
18507 
18508  /*--- Compute normal distance of the interior point from the wall ---*/
18509 
18510  for (iDim = 0; iDim < nDim; iDim++)
18511  WallDist[iDim] = (Coord[iDim] - Coord_Normal[iDim]);
18512 
18513  WallDistMod = 0.0;
18514  for (iDim = 0; iDim < nDim; iDim++)
18515  WallDistMod += WallDist[iDim]*WallDist[iDim];
18516  WallDistMod = sqrt(WallDistMod);
18517 
18518  /*--- Compute mach number ---*/
18519 
18520  // M_Normal = VelTangMod / sqrt(Gamma * Gas_Constant * T_Normal);
18521 
18522  /*--- Compute the wall temperature using the Crocco-Buseman equation ---*/
18523 
18524  //T_Wall = T_Normal * (1.0 + 0.5*Gamma_Minus_One*Recovery*M_Normal*M_Normal);
18525  T_Wall = T_Normal + Recovery*pow(VelTangMod,2.0)/(2.0*Cp);
18526 
18527  /*--- Extrapolate the pressure from the interior & compute the
18528  wall density using the equation of state ---*/
18529 
18530  P_Wall = P_Normal;
18531  Density_Wall = P_Wall/(Gas_Constant*T_Wall);
18532 
18533  /*--- Compute the shear stress at the wall in the regular fashion
18534  by using the stress tensor on the surface ---*/
18535 
18536  Lam_Visc_Wall = node[iPoint]->GetLaminarViscosity();
18537  grad_primvar = node[iPoint]->GetGradient_Primitive();
18538 
18539  div_vel = 0.0;
18540  for (iDim = 0; iDim < nDim; iDim++)
18541  div_vel += grad_primvar[iDim+1][iDim];
18542 
18543  for (iDim = 0; iDim < nDim; iDim++) {
18544  for (jDim = 0 ; jDim < nDim; jDim++) {
18545  Delta = 0.0; if (iDim == jDim) Delta = 1.0;
18546  tau[iDim][jDim] = Lam_Visc_Wall*( grad_primvar[jDim+1][iDim]
18547  + grad_primvar[iDim+1][jDim]) -
18548  TWO3*Lam_Visc_Wall*div_vel*Delta;
18549  }
18550  TauElem[iDim] = 0.0;
18551  for (jDim = 0; jDim < nDim; jDim++)
18552  TauElem[iDim] += tau[iDim][jDim]*UnitNormal[jDim];
18553  }
18554 
18555  /*--- Compute wall shear stress as the magnitude of the wall-tangential
18556  component of the shear stress tensor---*/
18557 
18558  TauNormal = 0.0;
18559  for (iDim = 0; iDim < nDim; iDim++)
18560  TauNormal += TauElem[iDim] * UnitNormal[iDim];
18561 
18562  for (iDim = 0; iDim < nDim; iDim++)
18563  TauTangent[iDim] = TauElem[iDim] - TauNormal * UnitNormal[iDim];
18564 
18565  WallShearStress = 0.0;
18566  for (iDim = 0; iDim < nDim; iDim++)
18567  WallShearStress += TauTangent[iDim]*TauTangent[iDim];
18568  WallShearStress = sqrt(WallShearStress);
18569 
18570  /*--- Calculate the quantities from boundary layer theory and
18571  iteratively solve for a new wall shear stress. Use the current wall
18572  shear stress as a starting guess for the wall function. ---*/
18573 
18574  Tau_Wall_Old = WallShearStress;
18575  counter = 0; diff = 1.0;
18576 
18577  while (diff > tol) {
18578 
18579  /*--- Friction velocity and u+ ---*/
18580 
18581  U_Tau = sqrt(Tau_Wall_Old/Density_Wall);
18582  U_Plus = VelTangMod/U_Tau;
18583 
18584  /*--- Gamma, Beta, Q, and Phi, defined by Nichols & Nelson (2004) ---*/
18585 
18586  Gam = Recovery*U_Tau*U_Tau/(2.0*Cp*T_Wall);
18587  Beta = 0.0; // For adiabatic flows only
18588  Q = sqrt(Beta*Beta + 4.0*Gam);
18589  Phi = asin(-1.0*Beta/Q);
18590 
18591  /*--- Y+ defined by White & Christoph (compressibility and heat transfer) negative value for (2.0*Gam*U_Plus - Beta)/Q ---*/
18592 
18593  Y_Plus_White = exp((kappa/sqrt(Gam))*(asin((2.0*Gam*U_Plus - Beta)/Q) - Phi))*exp(-1.0*kappa*B);
18594 
18595  /*--- Spalding's universal form for the BL velocity with the
18596  outer velocity form of White & Christoph above. ---*/
18597 
18598  Y_Plus = U_Plus + Y_Plus_White - (exp(-1.0*kappa*B)*
18599  (1.0 + kappa*U_Plus + kappa*kappa*U_Plus*U_Plus/2.0 +
18600  kappa*kappa*kappa*U_Plus*U_Plus*U_Plus/6.0));
18601 
18602  /*--- Calculate an updated value for the wall shear stress
18603  using the y+ value, the definition of y+, and the definition of
18604  the friction velocity. ---*/
18605 
18606  Tau_Wall = (1.0/Density_Wall)*pow(Y_Plus*Lam_Visc_Wall/WallDistMod,2.0);
18607 
18608  /*--- Difference between the old and new Tau. Update old value. ---*/
18609 
18610  diff = fabs(Tau_Wall-Tau_Wall_Old);
18611  Tau_Wall_Old += 0.25*(Tau_Wall-Tau_Wall_Old);
18612 
18613  counter++;
18614  if (counter > max_iter) {
18615  cout << "WARNING: Tau_Wall evaluation has not converged in solver_direct_mean.cpp" << endl;
18616  cout << Tau_Wall_Old << " " << Tau_Wall << " " << diff << endl;
18617  break;
18618  }
18619 
18620  }
18621 
18622 
18623  /*--- Store this value for the wall shear stress at the node. ---*/
18624 
18625  node[iPoint]->SetTauWall(Tau_Wall);
18626 
18627 
18628  }
18629 
18630  }
18631 
18632  }
18633  }
18634 
18635 }
#define B(i, j)
static void Error(std::string ErrorMsg, std::string FunctionName)
static void Barrier(Comm comm)
static void Recv(void *buf, int count, Datatype datatype, int dest, int tag, Comm comm, Status *status)
static void Gather(void *sendbuf, int sendcnt, Datatype sendtype, void *recvbuf, int recvcnt, Datatype recvtype, int root, Comm comm)
static void Allreduce(void *sendbuf, void *recvbuf, int count, Datatype datatype, Op op, Comm comm)
static void Reduce(void *sendbuf, void *recvbuf, int count, Datatype datatype, Op op, int root, Comm comm)
static void Bsend(void *buf, int count, Datatype datatype, int dest, int tag, Comm comm)
static void Bcast(void *buf, int count, Datatype datatype, int root, Comm comm)
static void Sendrecv(void *sendbuf, int sendcnt, Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcnt, Datatype recvtype, int source, int recvtag, Comm comm, Status *status)
Main class for defining the problem; basically this class reads the configuration file,...
su2double GetTemperature_FreeStreamND(void)
Get the value of the non-dimensionalized freestream temperature.
su2double GetRelaxation_Factor_Flow(void)
Get the relaxation coefficient of the linear solver for the implicit formulation.
string GetMarker_ActDiskInlet_TagBound(unsigned short val_marker)
Get the index of the surface defined in the geometry file.
void SetDensity_FreeStream(su2double val_density_freestream)
Set the Froude number for free surface problems.
su2double GetMu_Temperature_Ref(void)
Get the value of the reference temperature for Sutherland model.
void SetActDisk_TotalTempRatio(unsigned short val_imarker, su2double val_actdisk_tempratio)
Get the back pressure (static) at an outlet boundary.
string GetMarker_ActDiskOutlet_TagBound(unsigned short val_marker)
Get the index of the surface defined in the geometry file.
su2double GetExhaust_TotalPressure(string val_marker)
Get the total pressure at an engine exhaust boundary.
void SetModVel_FreeStreamND(su2double val_modvel_freestreamnd)
Set the Froude number for free surface problems.
void SetInflow_Force(unsigned short val_imarker, su2double val_fanface_force)
Set the force balance at an engine inflow boundary.
su2double GetLength_Reynolds(void)
Get the value of the Reynolds length.
su2double GetTime_Ref(void)
Get the value of the reference time for non-dimensionalization.
bool GetSpatialFourier(void)
Verify if there is mixing plane interface specified from config file.
su2double GetRiemann_Var2(string val_marker)
Get the var 2 at Riemann boundary.
void SetActDisk_Mach(unsigned short val_imarker, su2double val_actdisk_mach)
Get the back pressure (static) at an outlet boundary.
bool GetBoolGiles(void)
Verify if there is any Giles Boundary Condition option specified from config file.
void SetForce_Ref(su2double val_force_ref)
Set the Froude number for free surface problems.
su2double GetMu_Constant(void)
Get the value of the constant viscosity.
su2double GetPressure_Critical(void)
Get the value of the critical pressure.
void SetVelocity_FreeStreamND(su2double val_velocity_freestreamnd, unsigned short val_dim)
Set the Froude number for free surface problems.
long GetUnst_AdjointIter(void)
Get the starting direct iteration number for the unsteady adjoint (reverse time integration).
su2double GetExhaust_Pressure(string val_marker)
Get the back pressure (static) at an engine exhaust boundary.
unsigned short GetKind_Solver(void)
Governing equations of the flow (it can be different from the run time equation).
void SetCFL(unsigned short val_mesh, su2double val_cfl)
Get the Courant Friedrich Levi number for each grid.
su2double GetInflow_Force(string val_marker)
Get the force balance at an engine inflow boundary.
void SetExhaust_MassFlow(unsigned short val_imarker, su2double val_exhaust_massflow)
Set the back pressure (static) at an engine exhaust boundary.
su2double GetEnergy_FreeStreamND(void)
Get the value of the non-dimensionalized freestream energy.
su2double * GetRefOriginMoment(unsigned short val_marker)
Get reference origin for moment computation.
unsigned short GetActDisk_Jump(void)
Get the format of the output solution.
void SetActDiskInlet_TotalPressure(unsigned short val_imarker, su2double val_actdisk_totalpressure)
Get the back pressure (static) at an outlet boundary.
unsigned long GetUpdate_BCThrust(void)
Get the value of iterations to re-evaluate the angle of attack.
unsigned short GetKind_Centered_Flow(void)
Get the kind of center convective numerical scheme for the flow equations.
su2double * GetVelocity_FreeStreamND(void)
Get the vector of the non-dimensionalized freestream velocity.
su2double GetWall_HeatFlux(string val_index)
Get the wall heat flux on a constant heat flux boundary.
void SetMu_RefND(su2double mu_ref)
Set the value of the non-dimensional reference viscosity for Sutherland model.
unsigned long GetnExtIter(void)
Get the number of external iterations.
unsigned long GetWrt_Con_Freq(void)
Get the frequency for writing the convergence file.
su2double GetSurface_MassFlow(unsigned short val_imarker)
Get the massflow at an outlet boundary.
void SetMu_Temperature_RefND(su2double mu_Tref)
Set the value of the non-dimensional reference temperature for Sutherland model.
void SetActDiskOutlet_Pressure(unsigned short val_imarker, su2double val_actdisk_pressure)
Get the back pressure (static) at an outlet boundary.
unsigned short GetDirectDiff()
Get the direct differentation method.
su2double GetConductivity_Ref(void)
Get the value of the reference conductivity for non-dimensionalization.
su2double GetActDisk_TempJump(string val_marker, unsigned short val_index)
Get the thrust corffient of the actuator disk.
su2double GetUnst_CFL(void)
Get the Courant Friedrich Levi number for unsteady simulations.
su2double GetEnergy_Ref(void)
Get the value of the reference pressure for non-dimensionalization.
void SetWrt_Con_Freq(unsigned long val_freq)
Set the frequency for writing the convergence file.
void SetActDiskOutlet_GrossThrust(unsigned short val_imarker, su2double val_actdisk_grossthrust)
Get the back pressure (static) at an outlet boundary.
void SetVelocity_Ref(su2double val_velocity_ref)
Set the Froude number for free surface problems.
bool GetRestart_Flow(void)
For some problems like adjoint or the linearized equations it is necessary to restart the flow soluti...
unsigned short GetKind_FreeStreamOption(void)
free stream option to initialize the solution
su2double GetActDiskInlet_Pressure(string val_marker)
Get the back pressure (static) at an outlet boundary.
su2double GetMu_SND(void)
Get the value of the non-dimensional reference S for Sutherland model.
unsigned short GetKind_TimeIntScheme_Flow(void)
Get the kind of integration scheme (explicit or implicit) for the flow equations.
void SetExhaust_TotalPressure(unsigned short val_imarker, su2double val_exhaust_totalpressure)
Set the back pressure (total) at an engine exhaust boundary.
unsigned short GetKind_ConductivityModel(void)
Get the value of the thermal conductivity model.
su2double * GetInlet_FlowDir(string val_index)
Get the flow direction unit vector at an inlet boundary.
void SetInflow_Power(unsigned short val_imarker, su2double val_fanface_power)
Set the power at an engine inflow boundary.
su2double GetConst_DES(void)
Get the DES Constant.
void SetInflow_Pressure(unsigned short val_imarker, su2double val_fanface_pressure)
Set the fan face static pressure at an engine inflow boundary.
su2double GetGiles_Var2(string val_marker)
Get the var 2 for the Giles boundary.
unsigned short GetKind_SlopeLimit_Flow(void)
Get the method for limiting the spatial gradients.
su2double GetdCD_dCL(void)
Value of the weight of the CD, CL, CM optimization.
void SetActDiskInlet_Pressure(unsigned short val_imarker, su2double val_actdisk_pressure)
Get the back pressure (static) at an outlet boundary.
su2double GetInitial_BCThrust(void)
Get the value of the non-dimensionalized actuator disk turbulence intensity.
su2double GetEngine_Power(unsigned short val_imarker)
Get the back pressure (static) at an outlet boundary.
string GetMarker_EngineExhaust_TagBound(unsigned short val_marker)
Get the index of the surface defined in the geometry file.
su2double GetdCMy_dCL(void)
Value of the weight of the CD, CL, CM optimization.
bool GetContinuous_Adjoint(void)
Determines if problem is adjoint.
unsigned short GetKind_Data_Giles(string val_marker)
Get Kind Data for the Giles BC.
unsigned short GetMarker_All_Turbomachinery(unsigned short val_marker)
Get the Turbomachinery information for a marker val_marker.
unsigned short GetnSpanWiseSections(void)
number span-wise sections to compute 3D BC and performance for turbomachinery.
su2double GetExhaust_Temperature(string val_marker)
Get the temperature (static) at an engine exhaust boundary.
su2double GetAeroelastic_Frequency_Pitch(void)
Uncoupled Aeroelastic Frequency Pitch.
unsigned short GetKind_ObjFunc(void)
Get the kind of objective function. There are several options: Drag coefficient, Lift coefficient,...
unsigned short GetKind_Data_Riemann(string val_marker)
Get Kind Data of Riemann boundary.
unsigned short GetKind_HybridRANSLES(void)
Get the Kind of Hybrid RANS/LES.
su2double GetActDiskOutlet_Power(string val_marker)
Get the back pressure (static) at an outlet boundary.
bool GetViscous(void)
Determines if problem is viscous.
su2double GetViscosity_FreeStreamND(void)
Get the value of the non-dimensionalized freestream viscosity.
su2double GetInlet_Ptotal(string val_index)
Get the total pressure at an inlet boundary.
su2double GetPrandtl_Turb(void)
Get the value of the turbulent Prandtl number.
su2double GetOutlet_Pressure(string val_index)
Get the back pressure (static) at an outlet boundary.
unsigned short GetnMarker_All(void)
Get the total number of boundary markers.
unsigned short GetMarker_CfgFile_EngineExhaust(string val_marker)
Get Actuator Disk Outlet for boundary val_marker (actuator disk inlet).
void SetAoA(su2double val_AoA)
Set the angle of attack.
unsigned long GetIter_dCL_dAlpha(void)
Number of iterations to evaluate dCL_dAlpha.
bool GetUpdate_BCThrust_Bool(void)
Get information about whether to update the AoA for fixed lift mode.
void SetActDisk_DeltaPress(unsigned short val_imarker, su2double val_actdisk_deltapress)
Get the back pressure (static) at an outlet boundary.
void SetActDiskOutlet_Temperature(unsigned short val_imarker, su2double val_actdisk_temp)
Get the back pressure (static) at an outlet boundary.
void SetActDiskOutlet_TotalTemperature(unsigned short val_imarker, su2double val_actdisk_totaltemp)
Get the back pressure (static) at an outlet boundary.
unsigned short GetMarker_CfgFile_ActDiskOutlet(string val_marker)
Get Actuator Disk Outlet for boundary val_marker (actuator disk inlet).
unsigned short GetKind_ConvNumScheme_Flow(void)
Get the kind of convective numerical scheme for the flow equations (centered or upwind).
unsigned long GetIter_Fixed_CL(void)
Get the value of iterations to re-evaluate the angle of attack.
bool GetRead_Binary_Restart(void)
Flag for whether binary SU2 native restart files are read.
su2double GetSecondaryFlow_ActDisk(void)
Get the value of the non-dimensionalized actuator disk turbulence intensity.
su2double GetInflow_TotalTemperature(string val_marker)
Get the total temperature at an engine inflow boundary.
su2double GetPressure_Ref(void)
Get the value of the reference pressure for non-dimensionalization.
su2double * GetPeriodicRotation(unsigned short val_index)
Get the rotation angles for a periodic transformation.
void SetTime_Ref(su2double val_time_ref)
Set the Froude number for free surface problems.
unsigned short GetKind_AverageProcess(void)
Get the kind of mixing process for averaging quantities at the boundaries.
void SetEngine_Mach(unsigned short val_imarker, su2double val_engine_mach)
Set the back pressure (static) at an outlet boundary.
unsigned short GetKind_ConvNumScheme_AdjFlow(void)
Get the kind of convective numerical scheme for the adjoint flow equations (centered or upwind).
su2double GetActDisk_StaticTempRatio(unsigned short val_marker)
Get the back pressure (static) at an outlet boundary.
void SetActDiskOutlet_Power(unsigned short val_imarker, su2double val_actdisk_power)
Get the back pressure (static) at an outlet boundary.
unsigned short GetKind_Turb_Model(void)
Get the kind of the turbulence model.
void SetViscosity_Ref(su2double val_viscosity_ref)
Set the Froude number for free surface problems.
su2double GetDelta_UnstTimeND(void)
If we are prforming an unsteady simulation, there is only one value of the time step for the complete...
void SetActDiskInlet_Temperature(unsigned short val_imarker, su2double val_actdisk_temp)
Get the back pressure (static) at an outlet boundary.
su2double GetAoS(void)
Get the angle of sideslip of the body. It relates to the rotation of the aircraft centerline from the...
su2double GetExhaust_TotalTemperature(string val_marker)
Get the total temperature at an engine exhaust boundary.
su2double GetActDiskOutlet_MassFlow(string val_marker)
Get the back pressure (static) at an outlet boundary.
void SetNonphysical_Points(unsigned long val_nonphys_points)
Set the current number of non-physical nodes in the solution.
su2double GetReynolds(void)
Get the Reynolds number. Dimensionless number that gives a measure of the ratio of inertial forces to...
su2double GetInflow_TotalPressure(string val_marker)
Get the total pressure at an engine inflow boundary.
su2double GetMixedout_Coeff(unsigned short iCoeff)
Get mixedout coefficients.
bool GetFrozen_Limiter_Disc(void)
Provides information about the way in which the limiter will be treated by the disc....
unsigned short GetUnsteady_Simulation(void)
Provides information about the time integration, and change the write in the output files information...
su2double GetExtraRelFacGiles(unsigned short iCoeff)
Get extra relaxation factor coefficients for the Giels BC.
su2double GetTemperature_Critical(void)
Get the value of the critical temperature.
void SetMu_ConstantND(su2double mu_const)
Set the value of the non-dimensional constant viscosity.
bool Low_Mach_Preconditioning(void)
Get information about the Low Mach Preconditioning.
su2double GetDamp_Engine_Inflow(void)
Value of the damping factor for the engine inlet bc.
su2double GetActDiskInlet_Temperature(string val_marker)
Get the back pressure (static) at an outlet boundary.
void SetTotal_UnstTimeND(su2double val_total_unsttimend)
Set the Froude number for free surface problems.
su2double GetSurface_Mach(unsigned short val_imarker)
Get the mach number at an outlet boundary.
su2double GetActDisk_Area(string val_marker)
Get the tip radius of th actuator disk.
unsigned short GetnMarker_ActDiskInlet(void)
Get the total number of boundary markers.
su2double GetBuffet_lambda(void)
Get the buffet sensor offset parameter.
void SetOmega_Ref(su2double val_omega_ref)
Set the Froude number for free surface problems.
unsigned long GetUpdate_Alpha(void)
Get the value of iterations to re-evaluate the angle of attack.
su2double GetKt_Constant(void)
Get the value of the thermal conductivity.
su2double GetHighlite_Area(void)
Get the value of the reference viscosity for non-dimensionalization.
unsigned short GetKind_Linear_Solver(void)
Get the kind of solver for the implicit solver.
su2double GetSurface_SecondaryStrength(unsigned short val_imarker)
Get the secondary flow strength at the surface.
void SetOmega_FreeStream(su2double val_omega_freestream)
Set the Froude number for free surface problems.
su2double GetModVel_FreeStreamND(void)
Get the value of the frestream temperature.
unsigned short GetnMarker_Transpiration(void)
Get the total number of transpiration markers.
su2double GetActDisk_BCThrust_Old(string val_marker)
Get the origin of the actuator disk.
void SetModVel_FreeStream(su2double val_modvel_freestream)
Set the Froude number for free surface problems.
void SetActDisk_StaticPressRatio(unsigned short val_imarker, su2double val_actdisk_pressratio)
Get the back pressure (static) at an outlet boundary.
su2double GetdCMx_dCL(void)
Value of the weight of the CD, CL, CM optimization.
void SetEnergy_Ref(su2double val_energy_ref)
Set the Froude number for free surface problems.
su2double GetInflow_Power(string val_marker)
Get the power at an engine inflow boundary.
su2double * GetSubsonicEngine_Values(void)
Get the the coordinates where of the box where a subsonic region is imposed.
bool GetQCR(void)
Get QCR (SA-QCR2000).
void SetActDiskInlet_Power(unsigned short val_imarker, su2double val_actdisk_power)
Get the back pressure (static) at an outlet boundary.
unsigned short GetMarker_All_KindBC(unsigned short val_marker)
Get the kind of boundary for each marker.
su2double GetOmega_FreeStream(void)
Get the value of the non-dimensionalized freestream viscosity.
su2double GetExhaust_GrossThrust(string val_marker)
Get the gross thrust at an engine exhaust boundary.
void SetGas_Constant_Ref(su2double val_gas_constant_ref)
Set the Froude number for free surface problems.
su2double GetPressure_FreeStreamND(void)
Get the value of the non-dimensionalized freestream pressure.
su2double GetCFL(unsigned short val_mesh)
Get the Courant Friedrich Levi number for each grid.
bool GetRotating_Frame(void)
Get information about the rotational frame.
string GetMarker_Monitoring_TagBound(unsigned short val_marker)
Get the name of the surface defined in the geometry file.
unsigned short GetMarker_All_PyCustom(unsigned short val_marker)
Get the Python customization for a marker val_marker.
su2double * GetInlet_Velocity(string val_index)
Get the velocity vector at a supersonic inlet boundary.
void SetTemperature_FreeStream(su2double val_temperature_freestream)
Set the Froude number for free surface problems.
bool GetAeroelastic_Simulation(void)
Get information about the aeroelastic simulation.
bool Low_Mach_Correction(void)
Get information about the Low Mach Correction.
su2double GetGamma(void)
Get the value of the Gamma of fluid (ratio of specific heats).
unsigned short GetnSpanMaxAllZones(void)
number span-wise sections to compute performance for turbomachinery.
su2double GetActDiskOutlet_Force(string val_marker)
Get the back pressure (static) at an outlet boundary.
su2double GetAoA(void)
Get the angle of attack of the body. This is the angle between a reference line on a lifting body (of...
void SetTke_FreeStream(su2double val_tke_freestream)
Set the Froude number for free surface problems.
su2double GetActDiskOutlet_TotalTemperature(string val_marker)
Get the back pressure (static) at an outlet boundary.
su2double GetPrandtl_Lam(void)
Get the value of the laminar Prandtl number.
su2double Get_Alpha_RKStep(unsigned short val_step)
Get the alpha (convective) coefficients for the Runge-Kutta integration scheme.
su2double GetMach(void)
Get the value of the Mach number (velocity divided by speed of sound).
su2double GetInflow_Mach(string val_marker)
Get the fan face Mach number at an engine inflow boundary.
unsigned short GetnMarker_Monitoring(void)
Get the total number of monitoring markers.
su2double GetdCMz_dCL(void)
Value of the weight of the CD, CL, CM optimization.
su2double GetRefLength(void)
Get the reference length for computing moment (the default value is 1).
su2double GetTarget_CL(void)
Get the value specified for the target CL.
su2double GetGiles_RelaxFactorFourier(string val_marker)
Get the relax factor for the fourier component for the Giles BC.
bool GetGrid_Movement(void)
Get information about the grid movement.
su2double GetInlet_Ttotal(string val_index)
Get the total temperature at an inlet boundary.
unsigned short GetnMarker_NearFieldBound(void)
Get the total number of boundary markers.
su2double GetEngine_Force(unsigned short val_imarker)
Get the back pressure (static) at an outlet boundary.
su2double GetViscosity_FreeStream(void)
Get the value of the frestream temperature.
bool GetGravityForce(void)
Get information about the gravity force.
void SetDensity_FreeStreamND(su2double val_density_freestreamnd)
Set the Froude number for free surface problems.
su2double GetModVel_FreeStream(void)
Get the value of the frestream temperature.
su2double GetGiles_RelaxFactorAverage(string val_marker)
Get the relax factor for the average component for the Giles BC.
su2double GetGas_ConstantND(void)
Get the value of specific gas constant.
void SetdCL_dAlpha(su2double val_dcl_dalpha)
Value of the weight of the CD, CL, CM optimization.
su2double GetActDisk_StaticPressRatio(unsigned short val_marker)
Get the back pressure (static) at an outlet boundary.
bool GetBoolRiemann(void)
Verify if there is any Riemann Boundary Condition option specified from config file.
unsigned short GetnMarker_ActDiskOutlet(void)
Get the total number of boundary markers.
void SetInflow_ReverseMassFlow(unsigned short val_imarker, su2double val_fanface_reversemassflow)
Set the reverse flow at an engine inflow boundary.
void SetActDisk_Area(unsigned short val_imarker, su2double val_actdisk_area)
Get the back pressure (static) at an outlet boundary.
su2double GetIsothermal_Temperature(string val_index)
Get the wall temperature (static) at an isothermal boundary.
su2double GetdCL_dAlpha(void)
Get the value for the lift curve slope for fixed CL mode.
su2double GetSurface_Pressure(unsigned short val_imarker)
Get the pressure at an outlet boundary.
su2double GetExhaust_Temperature_Target(string val_index)
Get the total temperature at a nacelle boundary.
unsigned short GetnMarker_EngineInflow(void)
Get the total number of boundary markers.
su2double GetBuffet_k(void)
Get the buffet sensor sharpness coefficient.
void SetGas_Constant(su2double val_gas_constant)
Set the Froude number for free surface problems.
short GetMarker_All_SendRecv(unsigned short val_marker)
Get the send-receive information for a marker val_marker.
unsigned long GetIter_Fixed_NetThrust(void)
Get the value of iterations to re-evaluate the angle of attack.
bool GetEngine_HalfModel(void)
Only halg of the engine is in the compputational grid.
unsigned short GetKind_Linear_Solver_Prec(void)
Get the kind of preconditioner for the implicit solver.
su2double GetVenkat_LimiterCoeff(void)
Get the value of limiter coefficient.
su2double GetTke_FreeStream(void)
Get the value of the non-dimensionalized freestream viscosity.
su2double GetActDisk_Force(string val_marker)
Get the origin of the actuator disk.
su2double GetAcentric_Factor(void)
Get the value of the critical pressure.
su2double GetInflow_ReverseMassFlow(string val_marker)
Get the percentage of reverse flow at an engine inflow boundary.
void SetActDiskOutlet_TotalPressure(unsigned short val_imarker, su2double val_actdisk_totalpressure)
Get the back pressure (static) at an outlet boundary.
void SetExhaust_Force(unsigned short val_imarker, su2double val_exhaust_force)
Set the force balance at an engine exhaust boundary.
su2double GetMach_Motion(void)
Get the mach number based on the mesh velocity and freestream quantities.
void SetExhaust_Temperature(unsigned short val_imarker, su2double val_exhaust_temp)
Set the temperature (static) at an engine exhaust boundary.
su2double GetTemperature_FreeStream(void)
Get the value of the frestream temperature.
void SetInflow_Temperature(unsigned short val_imarker, su2double val_fanface_temperature)
Set the fan face static temperature at an engine inflow boundary.
void SetTemperature_Ref(su2double val_temperature_ref)
Set the reference temperature.
bool GetSteadyRestart(void)
Identifies if we want to restart from a steady or an unsteady solution.
void SetExhaust_GrossThrust(unsigned short val_imarker, su2double val_exhaust_grossthrust)
Set the gross thrust at an engine exhaust boundary.
unsigned short GetKind_Inlet(void)
Get the kind of inlet boundary condition treatment (total conditions or mass flow).
bool GetSubsonicEngine(void)
Divide the rectbles and hexahedron.
su2double GetActDisk_DeltaTemp(unsigned short val_marker)
Get the back pressure (static) at an outlet boundary.
su2double GetActDiskInlet_TotalTemperature(string val_marker)
Get the back pressure (static) at an outlet boundary.
void SetInflow_TotalTemperature(unsigned short val_imarker, su2double val_fanface_totaltemperature)
Set the fan face total temperature at an engine inflow boundary.
string GetMarker_EngineInflow_TagBound(unsigned short val_marker)
Get the index of the surface defined in the geometry file.
su2double GetMu_Temperature_RefND(void)
Get the value of the non-dimensional reference temperature for Sutherland model.
unsigned short GetKind_SlopeLimit_AdjFlow(void)
Get the method for limiting the spatial gradients.
su2double GetActDiskInlet_MassFlow(string val_marker)
Get the back pressure (static) at an outlet boundary.
void SetInflow_TotalPressure(unsigned short val_imarker, su2double val_fanface_totalpressure)
Set the fan face total pressure at an engine inflow boundary.
su2double GetDensity_Ref(void)
Get the value of the reference density for non-dimensionalization.
void SetLength_Ref(su2double val_length_ref)
Set the Froude number for free surface problems.
su2double GetInflow_Pressure(string val_marker)
Get the back pressure (static) at an engine inflow boundary.
void SetdCMz_dCL(su2double val_dcmz_dcl)
Value of the weight of the CD, CL, CM optimization.
void SetOmega_FreeStreamND(su2double val_omega_freestreamnd)
Set the Froude number for free surface problems.
su2double GetTemperature_Ref(void)
Get the value of the reference temperature for non-dimensionalization.
unsigned short GetnMarker_Turbomachinery(void)
number Turbomachinery performance option specified from config file.
su2double GetVelocity_Ref(void)
Get the value of the reference velocity for non-dimensionalization.
void SetTranspirationParams_DV()
Set the transpiration params using DV values.
void SetConductivity_Ref(su2double val_conductivity_ref)
Set the Froude number for free surface problems.
su2double * GetRiemann_FlowDir(string val_marker)
Get the Flowdir at Riemann boundary.
su2double GetEngineInflow_Target(string val_marker)
Get the target (pressure, massflow, etc) at an engine inflow boundary.
string GetUnsteady_FileName(string val_filename, int val_iter)
Augment the input filename with the iteration number for an unsteady file.
void SetEnergy_FreeStream(su2double val_energy_freestream)
Set the Froude number for free surface problems.
void SetEngine_Area(unsigned short val_imarker, su2double val_engine_area)
Get the back pressure (static) at an outlet boundary.
su2double GetAeroelastic_Flutter_Speed_Index(void)
Aeroelastic Flutter Speed Index.
unsigned short GetMarker_All_Monitoring(unsigned short val_marker)
Get the monitoring information for a marker val_marker.
su2double GetOmega_FreeStreamND(void)
Get the value of the non-dimensionalized freestream viscosity.
void SetKt_ConstantND(su2double kt_const)
Set the value of the non-dimensional thermal conductivity.
su2double GetExhaust_Force(string val_marker)
Get the force balance at an engine exhaust boundary.
su2double GetInflow_RamDrag(string val_marker)
Get the ram drag at an engine inflow boundary.
su2double * GetGiles_FlowDir(string val_marker)
Get the Flowdir for the Giles BC.
void SetActDiskInlet_MassFlow(unsigned short val_imarker, su2double val_actdisk_massflow)
Get the back pressure (static) at an outlet boundary.
su2double GetPressure_FreeStream(void)
Get the value of the non-dimensionalized freestream pressure.
su2double GetSurface_SecondOverUniform(unsigned short val_imarker)
Get the relative secondary flow strength at the surface.
void SetActDiskInlet_TotalTemperature(unsigned short val_imarker, su2double val_actdisk_totaltemp)
Get the back pressure (static) at an outlet boundary.
string GetMarker_All_TagBound(unsigned short val_marker)
Get the index of the surface defined in the geometry file.
su2double GetActDiskInlet_Force(string val_marker)
Get the back pressure (static) at an outlet boundary.
bool GetFSI_Simulation(void)
Check if the simulation we are running is a FSI simulation.
unsigned short GetKind_Upwind_Flow(void)
Get the kind of upwind convective numerical scheme for the flow equations.
su2double GetKt_ConstantND(void)
Get the value of the non-dimensional thermal conductivity.
static unsigned short GetnZone(string val_mesh_filename, unsigned short val_format, CConfig *config)
Gets the number of zones in the mesh file.
su2double GetEngine_GrossThrust(unsigned short val_imarker)
Get the back pressure (static) at an outlet boundary.
unsigned short GetnMarker_TurboPerformance(void)
number Turbomachinery performance option specified from config file.
bool GetBody_Force(void)
Get information about the body force.
su2double GetEngine_NetThrust(unsigned short val_imarker)
Get the back pressure (static) at an outlet boundary.
su2double GetActDiskOutlet_GrossThrust(string val_marker)
Get the back pressure (static) at an outlet boundary.
void SetDelta_UnstTimeND(su2double val_delta_unsttimend)
Set the value of the unsteadty time step using the CFL number.
su2double GetSurface_TotalPressure(unsigned short val_imarker)
Get the total pressure at an outlet boundary.
su2double GetActDisk_Power(string val_marker)
Get the origin of the actuator disk.
bool GetFixed_CM_Mode(void)
Get information about whether to use fixed CL mode.
void SetExhaust_TotalTemperature(unsigned short val_imarker, su2double val_exhaust_totaltemp)
Set the total temperature at an engine exhaust boundary.
void SetActDisk_GrossThrust(unsigned short val_imarker, su2double val_actdisk_grossthrust)
Get the back pressure (static) at an outlet boundary.
void SetActDisk_BCThrust_Old(string val_marker, su2double val_actdisk_bcthrust_old)
Get the back pressure (static) at an outlet boundary.
void SetNonphysical_Reconstr(unsigned long val_nonphys_reconstr)
Set the current number of non-physical reconstructions for 2nd-order upwinding.
su2double GetGas_Constant_Ref(void)
Get the reference value for the specific gas constant.
unsigned long GetExtIter(void)
Get the current external iteration number.
void SetPressure_Ref(su2double val_pressure_ref)
Set the Froude number for free surface problems.
void SetEngine_GrossThrust(unsigned short val_imarker, su2double val_engine_grossthrust)
Get the back pressure (static) at an outlet boundary.
void SetTke_FreeStreamND(su2double val_tke_freestreamnd)
Set the Froude number for free surface problems.
void SetPressure_FreeStreamND(su2double val_pressure_freestreamnd)
Set the Froude number for free surface problems.
su2double GetEnergy_FreeStream(void)
Get the value of the frestream temperature.
unsigned short GetConsole_Output_Verb(void)
Get the verbosity level of the console output.
su2double GetDelta_UnstTime(void)
If we are prforming an unsteady simulation, there is only one value of the time step for the complete...
su2double GetFan_Poly_Eff(void)
Get the value of the reference viscosity for non-dimensionalization.
bool GetMUSCL_Flow(void)
Get if the upwind scheme used MUSCL or not.
unsigned short GetRef_NonDim(void)
Get the kind of non-dimensionalization.
su2double GetdCD_dCMy(void)
Value of the weight of the CD, CL, CM optimization.
su2double GetActDisk_Mach(string val_marker)
Get the origin of the actuator disk.
su2double GetActDisk_TotalTempRatio(unsigned short val_marker)
Get the back pressure (static) at an outlet boundary.
su2double GetInflow_MassFlow(string val_marker)
Get the mass flow rate at an engine inflow boundary.
su2double GetActDiskOutlet_TotalPressure(string val_marker)
Get the back pressure (static) at an outlet boundary.
long GetUnst_RestartIter(void)
Get the restart iteration number for unsteady simulations.
su2double GetMu_S(void)
Get the value of the reference S for Sutherland model.
void SetInflow_MassFlow(unsigned short val_imarker, su2double val_fanface_massflow)
Set the massflow at an engine inflow boundary.
su2double GetEngine_Mach(unsigned short val_imarker)
Get the back pressure (static) at an outlet boundary.
su2double GetTurb2LamViscRatio_FreeStream(void)
Get the value of the turbulent to laminar viscosity ratio.
void SetActDisk_NetThrust(unsigned short val_imarker, su2double val_actdisk_netthrust)
Get the back pressure (static) at an outlet boundary.
su2double GetExhaust_Power(string val_marker)
Get the power at an engine exhaust boundary.
unsigned short GetMarker_All_TurbomachineryFlag(unsigned short val_marker)
Get the Turbomachinery flag information for a marker val_marker.
su2double GetMu_ConstantND(void)
Get the value of the non-dimensional constant viscosity.
unsigned short GetnMarker_EngineExhaust(void)
Get the total number of boundary markers.
unsigned short GetKind_PerformanceAverageProcess(void)
Get the kind of mixing process for averaging quantities at the boundaries.
void SetExhaust_Power(unsigned short val_imarker, su2double val_exhaust_power)
Set the power at an engine exhaust boundary.
void SetPressure_FreeStream(su2double val_pressure_freestream)
Set the Froude number for free surface problems.
su2double GetActDisk_DeltaPress(unsigned short val_marker)
Get the back pressure (static) at an outlet boundary.
void GetTranspirationParams(string val_marker, su2double &x0, su2double &x1, su2double &x2, su2double &x3, su2double &y0, su2double &y1, su2double &y2, su2double &y3, su2double &eps0, su2double &eps1, su2double &eps2, su2double &eps3)
Get the wall transpiration parameters.
bool GetFixed_CL_Mode(void)
Get information about whether to use fixed CL mode.
void SetActDisk_TotalPressRatio(unsigned short val_imarker, su2double val_actdisk_pressratio)
Get the back pressure (static) at an outlet boundary.
su2double GetAeroelastic_Airfoil_Mass_Ratio(void)
Aeroelastic Airfoil Mass Ratio.
bool GetDiscrete_Adjoint(void)
Get the indicator whether we are solving an discrete adjoint problem.
bool GetWind_Gust(void)
Get information about the wind gust.
unsigned short GetiZone(void)
Provides the number of varaibles.
void SetEnergy_FreeStreamND(su2double val_energy_freestreamnd)
Set the Froude number for free surface problems.
void SetActDisk_Force(unsigned short val_imarker, su2double val_actdisk_force)
Get the back pressure (static) at an outlet boundary.
void SetActDisk_StaticTempRatio(unsigned short val_imarker, su2double val_actdisk_tempratio)
Get the back pressure (static) at an outlet boundary.
unsigned short GetKind_FluidModel(void)
Fluid model that we are using.
unsigned short GetKind_RoeLowDiss(void)
Get the Kind of Roe Low Dissipation Scheme for Unsteady flows.
unsigned short GetKind_InitOption(void)
free stream option to initialize the solution
unsigned short GetKind_ActDisk(void)
Get the kind of inlet boundary condition treatment (total conditions or mass flow).
void SetActDiskInlet_RamDrag(unsigned short val_imarker, su2double val_actdisk_ramdrag)
Get the back pressure (static) at an outlet boundary.
bool GetAxisymmetric(void)
Get information about the axisymmetric frame.
void SetActDiskInlet_Force(unsigned short val_imarker, su2double val_actdisk_force)
Get the back pressure (static) at an outlet boundary.
bool GetUpdate_AoA(void)
Get information about whether to update the AoA for fixed lift mode.
su2double * GetFreeStreamTurboNormal(void)
Set freestream turbonormal for initializing solution.
void SetActDisk_Power(unsigned short val_imarker, su2double val_actdisk_power)
Get the back pressure (static) at an outlet boundary.
su2double GetTurbulenceIntensity_FreeStream(void)
Get the value of the non-dimensionalized freestream turbulence intensity.
su2double GetExhaust_MassFlow(string val_marker)
Get the massflow at an engine exhaust boundary.
su2double GetSurface_MomentumDistortion(unsigned short val_imarker)
Get the momentum distortion at the surface.
su2double GetInflow_Temperature(string val_marker)
Get the temperature (static) at an engine inflow boundary.
su2double GetTotal_UnstTimeND(void)
If we are prforming an unsteady simulation, there is only one value of the time step for the complete...
su2double GetGas_Constant(void)
Get the value of specific gas constant.
su2double GetDensity_FreeStreamND(void)
Get the value of the non-dimensionalized freestream density.
unsigned short GetKind_Upwind(void)
Get kind of upwind scheme for the convective terms.
void SetInflow_RamDrag(unsigned short val_imarker, su2double val_fanface_ramdrag)
Set the ram drag temperature at an engine inflow boundary.
su2double GetmaxTurkelBeta()
Get the minimum value of Beta for Roe-Turkel preconditioner.
void SetActDiskInlet_ReverseMassFlow(unsigned short val_imarker, su2double val_actdisk_area)
Get the back pressure (static) at an outlet boundary.
su2double GetActDiskInlet_RamDrag(string val_marker)
Get the back pressure (static) at an outlet boundary.
void SetEngine_Force(unsigned short val_imarker, su2double val_engine_force)
Set the back pressure (static) at an outlet boundary.
su2double * GetSubsonicEngine_Cyl(void)
Get the the coordinates where of the box where a subsonic region is imposed.
bool GetWall_Functions(void)
Get information about whether to use wall functions.
su2double GetRiemann_Var1(string val_marker)
Get the var 1 at Riemann boundary.
su2double GetRefArea(void)
Get the reference area for non dimensional coefficient computation. If the value from the is 0 then,...
void SetUpdate_AoA(bool val_update)
Set the value of the boolean for updating AoA in fixed lift mode.
void SetViscosity_FreeStream(su2double val_viscosity_freestream)
Set the Froude number for free surface problems.
void SetViscosity_FreeStreamND(su2double val_viscosity_freestreamnd)
Set the Froude number for free surface problems.
unsigned short GetKind_Engine_Inflow(void)
Get the kind of inlet boundary condition treatment (total conditions or mass flow).
su2double GetActDisk_NetThrust(string val_marker)
Get the origin of the actuator disk.
su2double GetRefElemLength(void)
Get the reference element length for computing the slope limiting epsilon.
void SetdCMy_dCL(su2double val_dcmy_dcl)
Value of the weight of the CD, CL, CM optimization.
string GetSolution_FlowFileName(void)
Get the name of the file with the solution of the flow problem.
void SetUpdate_BCThrust_Bool(bool val_update)
Set the value of the boolean for updating AoA in fixed lift mode.
void SetGas_ConstantND(su2double val_gas_constantnd)
Set the Froude number for free surface problems.
unsigned short GetKind_SlopeLimit_Turb(void)
Get the method for limiting the spatial gradients.
su2double GetDamp_Engine_Exhaust(void)
Value of the damping factor for the engine exhaust inlet bc.
su2double GetdNetThrust_dBCThrust(void)
Get the value of the damping coefficient for fixed CL mode.
bool GetTranspiration_Objective(void)
Provides the transpiration objective information.
su2double GetTotal_UnstTime(void)
If we are performing an unsteady simulation, this is the value of max physical time for which we run ...
void SetActDiskOutlet_MassFlow(unsigned short val_imarker, su2double val_actdisk_massflow)
Get the back pressure (static) at an outlet boundary.
su2double GetViscosity_Ref(void)
Get the value of the reference viscosity for non-dimensionalization.
su2double GetInlet_Pressure(string val_index)
Get the pressure at a supersonic inlet boundary.
void SetdCD_dCL(su2double val_dcd_dcl)
Value of the weight of the CD, CL, CM optimization.
bool GetRestart(void)
Provides the restart information.
void SetEngine_Power(unsigned short val_imarker, su2double val_engine_power)
Get the back pressure (static) at an outlet boundary.
su2double GetActDisk_PressJump(string val_marker, unsigned short val_index)
Get the thrust corffient of the actuator disk.
void SetInitial_BCThrust(su2double val_bcthrust)
Get the value of the non-dimensionalized actuator disk turbulence intensity.
void SetActDisk_DeltaTemp(unsigned short val_imarker, su2double val_actdisk_deltatemp)
Get the back pressure (static) at an outlet boundary.
su2double GetActDisk_MassFlow(string val_marker)
Get the origin of the actuator disk.
su2double GetWeight_ObjFunc(unsigned short val_obj)
Get the weight of objective function. There are several options: Drag coefficient,...
void SetFroude(su2double val_froude)
Set the Froude number for free surface problems.
su2double GetDensity_FreeStream(void)
Get the value of the frestream temperature.
su2double GetActDiskInlet_TotalPressure(string val_marker)
Get the back pressure (static) at an outlet boundary.
unsigned short GetnMGLevels(void)
Get the number of multigrid levels.
su2double GetMax_DeltaTime(void)
Get the Courant Friedrich Levi number for unsteady simulations.
su2double GetMu_Ref(void)
Get the value of the reference viscosity for Sutherland model.
void SetDensity_Ref(su2double val_density_ref)
Set the Froude number for free surface problems.
string GetMultizone_FileName(string val_filename, int val_iZone)
Append the zone index to the restart or the solution files.
su2double GetInlet_Temperature(string val_index)
Get the temperature at a supersonic inlet boundary.
su2double GetActDisk_ReverseMassFlow(string val_marker)
Get the tip radius of th actuator disk.
su2double * GetVelocity_FreeStream(void)
Get the vector of the dimensionalized freestream velocity.
void SetActDisk_BCThrust(string val_marker, su2double val_actdisk_bcthrust)
Get the back pressure (static) at an outlet boundary.
void SetActDiskOutlet_Force(unsigned short val_imarker, su2double val_actdisk_force)
Get the back pressure (static) at an outlet boundary.
bool GetBuffet_Monitoring(void)
Provides the buffet monitoring information.
su2double GetActDisk_BCThrust(string val_marker)
Get the origin of the actuator disk.
su2double GetActDisk_TotalPressRatio(unsigned short val_marker)
Get the back pressure (static) at an outlet boundary.
su2double GetExhaust_Pressure_Target(string val_index)
Get the total pressure at an nacelle boundary.
su2double GetActDiskOutlet_Pressure(string val_marker)
Get the back pressure (static) at an outlet boundary.
unsigned short GetKind_ViscosityModel(void)
Get the value of the viscosity model.
su2double GetTke_FreeStreamND(void)
Get the value of the non-dimensionalized freestream viscosity.
su2double GetAverageMachLimit(void)
Get mach limit for average massflow-based procedure .
su2double GetActDiskOutlet_Temperature(string val_marker)
Get the back pressure (static) at an outlet boundary.
void SetActDisk_MassFlow(unsigned short val_imarker, su2double val_actdisk_massflow)
Get the back pressure (static) at an outlet boundary.
su2double GetActDiskInlet_Power(string val_marker)
Get the back pressure (static) at an outlet boundary.
unsigned short GetKind_TurboMachinery(unsigned short val_iZone)
Get the kind of turbomachinery architecture.
void SetExhaust_Pressure(unsigned short val_imarker, su2double val_exhaust_pressure)
Set the back pressure (static) at an engine exhaust boundary.
void SetTemperature_FreeStreamND(su2double val_temperature_freestreamnd)
Set the Froude number for free surface problems.
unsigned short GetSystemMeasurements(void)
Governing equations of the flow (it can be different from the run time equation).
su2double GetGiles_Var1(string val_marker)
Get the var 1 for the Giels BC.
unsigned short GetMarker_CfgFile_TagBound(string val_marker)
Get the index in the config information of the marker val_marker.
unsigned short GetKind_Gradient_Method(void)
Get the kind of method for computation of spatial gradients.
void SetdCMx_dCL(su2double val_dcmx_dcl)
Value of the weight of the CD, CL, CM optimization.
void SetMu_SND(su2double mu_s)
Set the value of the non-dimensional S for Sutherland model.
void SetEngine_NetThrust(unsigned short val_imarker, su2double val_engine_netthrust)
Get the back pressure (static) at an outlet boundary.
su2double GetActDisk_GrossThrust(unsigned short val_marker)
Get the back pressure (static) at an outlet boundary.
su2double GetSurface_Uniformity(unsigned short val_imarker)
Get the streamwise flow uniformity at the surface.
void GetNormal(su2double *val_normal)
Copy the the normal vector of a face.
unsigned long GetNode(unsigned short val_node)
Get the nodes of the edge.
Main class for defining the Euler's flow solver.
void BC_TurboRiemann(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose the boundary condition using characteristic recostruction.
void SetTotal_Prop_Eff(su2double val_Total_Prop_Eff)
Store the total (inviscid + viscous) non dimensional drag coefficient.
su2double * iPoint_UndLapl
Auxiliary variable for the undivided Laplacians.
su2double * Surface_MaxHF_Visc
Maximum heat flux for each monitored surface.
su2double Temperature_Inf
Energy at the infinity.
su2double * Primitive_i
Auxiliary nPrimVar vector for storing the primitive at point i.
su2double * Surface_CFx_Mnt
x Force coefficient (inviscid contribution) for each monitoring surface.
su2double * CEff_Inv
Efficiency (Cl/Cd) (inviscid contribution) for each boundary.
su2double AllBound_CFz_Inv
Total z force coefficient (inviscid contribution) for all the boundaries.
void BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose the nacelle inflow boundary condition.
su2double Gamma
Fluid's Gamma constant (ratio of specific heats).
su2double Total_CD_Prev
Total drag coefficient for all the boundaries (fixed lift mode).
su2double Total_ComboObj
Total 'combo' objective for all monitored boundaries.
su2double * Surface_CFy_Inv
y Force coefficient (inviscid contribution) for each monitoring surface.
void Evaluate_ObjFunc(CConfig *config)
Compute weighted-sum "combo" objective output.
su2double AllBound_CMerit_Inv
Rotor Figure of Merit (inviscid contribution) for all the boundaries.
void Set_MPI_Nearfield(CGeometry *geometry, CConfig *config)
Parallelization of Undivided Laplacian.
su2double AoA_Prev
Old value of the AoA for fixed lift mode.
void ComputeConsExtrapolation(CConfig *config)
Compute the extrapolated quantities, for MUSCL upwind 2nd reconstruction, in a more thermodynamic con...
complex< su2double > *** CkInflow
unsigned short nMarkerTurboPerf
Number of turbo performance.
su2double ** AverageKine
su2double * Surface_CMz_Inv
z Moment coefficient (inviscid contribution) for each monitoring surface.
su2double Energy_Inf
Energy at the infinity.
su2double * Surface_CD_Mnt
Drag coefficient (inviscid contribution) for each monitoring surface.
void UpdateSolution_BGS(CGeometry *geometry, CConfig *config)
Store the BGS solution in the previous subiteration in the corresponding vector.
su2double ** RadialEquilibriumPressure
su2double ** AverageNu
void SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, bool Output)
Update the AoA and freestream velocity at the farfield.
su2double * CQ_Mnt
Torque coefficient (moment in -x direction, inviscid contribution) for each boundary.
void Set_MPI_Sensor(CGeometry *geometry, CConfig *config)
Parallelization of SetPressure_Sensor.
su2double * CSF_Mnt
Sideforce coefficient (inviscid contribution) for each boundary.
su2double Total_CMz_Prev
Total drag coefficient for all the boundaries (fixed lift mode).
su2double * Primitive
Auxiliary nPrimVar vector.
su2double Total_CMx_Prev
Total drag coefficient for all the boundaries (fixed lift mode).
su2double AllBound_CMz_Inv
Total z moment coefficient (inviscid contribution) for all the boundaries.
su2double Total_CMy
Total y moment coefficient for all the boundaries.
CFluidModel * FluidModel
fluid model used in the solver
su2double * CL_Inv
Lift coefficient (inviscid contribution) for each boundary.
void SetNondimensionalization(CConfig *config, unsigned short iMesh)
Set the solver nondimensionalization.
su2double Total_CNearFieldOF
Total Near-Field Pressure coefficient for all the boundaries.
su2double * Surface_CMy_Inv
y Moment coefficient (inviscid contribution) for each monitoring surface.
su2double * Surface_CD
Drag coefficient for each monitoring surface.
su2double * CoPz_Inv
z Moment coefficient (inviscid contribution) for each boundary.
void ExplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config)
Update the solution using the explicit Euler scheme.
void SetTranspiration(CGeometry *geometry, CConfig *config)
Set transpiration value.
su2double Gamma_Minus_One
Fluids's Gamma - 1.0 .
su2double GetSlidingState(unsigned short val_marker, unsigned long val_vertex, unsigned short val_state, unsigned long donor_index)
Get the outer state for fluid interface nodes.
void BC_Riemann(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose the boundary condition using characteristic recostruction.
void SetTotal_MFR(su2double val_Total_MFR)
Store the total (inviscid + viscous) non dimensional drag coefficient.
su2double Total_AeroCD
Total aero drag coefficient for all the boundaries.
su2double GetTotal_CD(void)
Provide the total (inviscid + viscous) non dimensional drag coefficient.
su2double GetDensity_Inf(void)
Compute the density at the infinity.
su2double * Cauchy_Serie
Complete Cauchy serial.
void Set_MPI_Solution_Old(CGeometry *geometry, CConfig *config)
Impose the send-receive boundary condition.
su2double Old_Func
Old value of the objective function (the function which is monitored).
unsigned long GetDonorGlobalIndex(unsigned short val_marker, unsigned long val_vertex)
Value of the characteristic global index at the boundaries.
void BC_Interface_Boundary(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short val_marker)
Impose the interface boundary condition using the residual.
su2double Mach_Inf
Mach number at the infinity.
su2double AllBound_CD_Mnt
Total drag coefficient (inviscid contribution) for all the boundaries.
su2double * Surface_CD_Inv
Drag coefficient (inviscid contribution) for each monitoring surface.
su2double AllBound_CD_Inv
Total drag coefficient (inviscid contribution) for all the boundaries.
su2double Cauchy_Func
Current value of the convergence indicator at one iteration.
su2double ** DensityOut
void SetActDisk_DeltaT(unsigned short val_marker, unsigned long val_vertex, su2double val_deltat)
Value of the characteristic global index at the boundaries.
su2double Total_CSF
Total sideforce coefficient for all the boundaries.
su2double GetActDisk_DeltaP(unsigned short val_marker, unsigned long val_vertex)
Value of the characteristic global index at the boundaries.
su2double Total_CoPy
Total y moment coefficient for all the boundaries.
su2double * PrimVar_i
Auxiliary vector for storing the solution at point i.
su2double * CT_Inv
Thrust coefficient (force in -x direction, inviscid contribution) for each boundary.
su2double Total_IDR
Total IDC coefficient for all the boundaries.
void SetCentered_Dissipation_Sensor(CGeometry *geometry, CConfig *config)
Compute a pressure sensor switch.
su2double Total_Custom_ObjFunc
Total custom objective function for all the boundaries.
su2double AoA_old
Old value of the angle of attack (monitored).
su2double * Surface_CFz_Inv
z Force coefficient (inviscid contribution) for each monitoring surface.
su2double Pressure_Inf
Pressure at the infinity.
void Source_Template(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short iMesh)
Source term integration.
su2double *** AverageTurboVelocity
void PreprocessBC_Giles(CGeometry *geometry, CConfig *config, CNumerics *conv_numerics, unsigned short marker_flag)
It computes Fourier transformation for the needed quantities along the pitch for each span in turboma...
su2double * CoPz_Mnt
z Moment coefficient (inviscid contribution) for each boundary.
su2double * CD_Inv
Drag coefficient (inviscid contribution) for each boundary.
su2double AllBound_Cmu
Total jet blowing coefficientfor all the boundaries.
unsigned short Cauchy_Counter
Number of elements of the Cauchy serial.
void Set_MPI_Solution(CGeometry *geometry, CConfig *config)
Impose the send-receive boundary condition.
su2double * Surface_CFz
z Force coefficient for each monitoring surface.
unsigned long * nVertex
Store nVertex at each marker for deallocation.
su2double Cauchy_Value
Summed value of the convergence indicator.
su2double ** ExtAverageDensity
su2double ** PressureOut
void BC_Far_Field(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose the far-field boundary condition using characteristics.
su2double ** HeatFlux
Heat transfer coefficient for each boundary and vertex.
su2double * jPoint_UndLapl
Auxiliary variable for the undivided Laplacians.
void BC_Sym_Plane(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose the symmetry boundary condition using the residual.
su2double * CMy_Inv
y Moment coefficient (inviscid contribution) for each boundary.
su2double AllBound_CMx_Mnt
Total x moment coefficient (inviscid contribution) for all the boundaries.
void BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose the ancelle exhaust boundary condition.
su2double ** HeatFluxTarget
Heat transfer coefficient for each boundary and vertex.
void SetPrimitive_Limiter(CGeometry *geometry, CConfig *config)
Compute the limiter of the primitive variables.
void Set_MPI_Primitive_Gradient(CGeometry *geometry, CConfig *config)
Compute the gradient of the primitive variables using a Least-Squares method, and stores the result i...
su2double * Surface_HF_Visc
Total (integrated) heat flux for each monitored surface.
su2double Total_CMx
Total x moment coefficient for all the boundaries.
void LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo)
Load a solution from a restart file.
su2double GetInletAtVertex(su2double *val_inlet, unsigned long val_inlet_point, unsigned short val_kind_marker, string val_marker, CGeometry *geometry, CConfig *config)
Get the set of value imposed at an inlet.
su2double AllBound_CMy_Inv
Total y moment coefficient (inviscid contribution) for all the boundaries.
su2double ** ActDisk_DeltaT
Value of the Delta T.
su2double **** SlidingState
su2double * MomentMomentum
Inviscid moment for each boundary.
su2double Total_CD
Total drag coefficient for all the boundaries.
void InitTurboContainers(CGeometry *geometry, CConfig *config)
Initilize turbo containers.
su2double GetPressure_Inf(void)
Compute the pressure at the infinity.
su2double * Inflow_Area
Boundary total area.
void SetUniformInlet(CConfig *config, unsigned short iMarker)
Set a uniform inlet profile.
void SetTotal_Power(su2double val_Total_Power)
Store the total (inviscid + viscous) non dimensional drag coefficient.
unsigned long ** DonorGlobalIndex
Value of the donor global index.
su2double *** Inlet_FlowDir
Value of the Flow Direction.
void ImplicitEuler_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config)
Update the solution using an implicit Euler scheme.
su2double ** OldAveragePressure
su2double AllBound_CQ_Inv
Total torque coefficient (inviscid contribution) for all the boundaries.
complex< su2double > *** CkOutflow2
su2double * GetCharacPrimVar(unsigned short val_marker, unsigned long val_vertex)
Value of the characteristic variables at the boundaries.
void SetTotal_Adiab_Eff(su2double val_Total_Adiab_Eff)
Store the total (inviscid + viscous) non dimensional drag coefficient.
su2double * CQ_Inv
Torque coefficient (moment in -x direction, inviscid contribution) for each boundary.
su2double *** AverageFlux
void Postprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh)
A virtual member.
void Set_MPI_Interface(CGeometry *geometry, CConfig *config)
Parallelization of Undivided Laplacian.
su2double ** AverageOmega
bool space_centered
True if space centered scheeme used.
su2double * CNearFieldOF_Inv
Near field pressure (inviscid contribution) for each boundary.
su2double Total_CMerit
Total rotor Figure of Merit for all the boundaries.
su2double ** CPressureTarget
Target Pressure coefficient for each boundary and vertex.
su2double * Surface_CEff
Side-force coefficient for each monitoring surface.
su2double Total_CMy_Prev
Total drag coefficient for all the boundaries (fixed lift mode).
su2double Total_Cmu
Jet blowing on all boundaries.
su2double ** YPlus
Yplus for each boundary and vertex.
su2double * Surface_CFz_Mnt
z Force coefficient (inviscid contribution) for each monitoring surface.
su2double *** AverageVelocity
su2double ** Inlet_Ptotal
Value of the Total P.
su2double * CFz_Inv
z Force coefficient (inviscid contribution) for each boundary.
su2double * Surface_CMy
y Moment coefficient for each monitoring surface.
void SetInletAtVertex(su2double *val_inlet, unsigned short iMarker, unsigned long iVertex)
Store of a set of provided inlet profile values at a vertex.
su2double * Surface_Cmu
Jet blowing coefficient for each monitoring surface.
su2double Density_Inf
Density at the infinity.
void BC_Supersonic_Outlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose a supersonic outlet boundary condition.
su2double *** TurboVelocityIn
su2double ** OldAverageDensity
su2double * Cmu
Jet blowing coeficient for each boundary.
su2double ** ExtAverageKine
void SetTotal_Poly_Eff(su2double val_Total_Poly_Eff)
Store the total (inviscid + viscous) non dimensional drag coefficient.
void Set_MPI_Solution_Gradient(CGeometry *geometry, CConfig *config)
Impose the send-receive boundary condition.
su2double *** CharacPrimVar
Value of the characteristic variables at each boundary.
su2double *** DonorPrimVar
Value of the donor variables at each boundary.
su2double * Velocity_Inf
Flow Velocity vector at the infinity.
su2double * Surface_CMz
z Moment coefficient for each monitoring surface.
su2double AllBound_CFz_Mnt
Total z force coefficient (inviscid contribution) for all the boundaries.
void Set_MPI_ActDisk(CSolver **solver_container, CGeometry *geometry, CConfig *config)
Parallelization of Undivided Laplacian.
su2double *** SpanTotalFlux
su2double Total_CFz
Total z force coefficient for all the boundaries.
void BC_ActDisk_Outlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose the engine exhaust boundary condition.
su2double AllBound_CoPz_Inv
Total z moment coefficient (inviscid contribution) for all the boundaries.
su2double ** ExtAverageNu
su2double * Surface_CFx_Inv
x Force coefficient (inviscid contribution) for each monitoring surface.
void Centered_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short iMesh, unsigned short iRKStep)
Compute the spatial integration using a centered scheme.
su2double * Surface_CSF_Mnt
Side-force coefficient (inviscid contribution) for each monitoring surface.
su2double * CMerit_Inv
Rotor Figure of Merit (inviscid contribution) for each boundary.
su2double ** NuIn
su2double * Surface_CMx_Mnt
x Moment coefficient (inviscid contribution) for each monitoring surface.
su2double ** DensityIn
void SetMax_Eigenvalue(CGeometry *geometry, CConfig *config)
Compute the max eigenvalue.
void SetTotal_ReverseFlow(su2double val_ReverseFlow)
Store the total (inviscid + viscous) non dimensional drag coefficient.
su2double AllBound_CEff_Inv
Efficient coefficient (inviscid contribution) for all the boundaries.
su2double * CD_Mnt
Drag coefficient (inviscid contribution) for each boundary.
su2double ** OmegaOut
void SetTotal_SolidCD(su2double val_Total_SolidCD)
Store the total (inviscid + viscous) non dimensional drag coefficient.
su2double AllBound_CMz_Mnt
Total z moment coefficient (inviscid contribution) for all the boundaries.
su2double * Surface_CMx
x Moment coefficient for each monitoring surface.
su2double Total_CpDiff
Total Equivalent Area coefficient for all the boundaries.
su2double ** OmegaIn
void BC_Euler_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short val_marker)
Impose via the residual the Euler wall boundary condition.
su2double * Inflow_MassFlow
Mass flow rate for each boundary.
void ComputeBackVelocity(su2double *turboVelocity, su2double *turboNormal, su2double *cartesianVelocity, unsigned short marker_flag, unsigned short marker_kindturb)
it take a velocity in the cartesian reference of framework and transform into the turbomachinery fram...
void BC_Dirichlet(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short val_marker)
Impose the dirichlet boundary condition using the residual.
void SetInitialCondition(CGeometry **geometry, CSolver ***solver_container, CConfig *config, unsigned long ExtIter)
Set the initial condition for the Euler Equations.
unsigned long AoA_Counter
su2double ** KineOut
complex< su2double > *** CkOutflow1
void Set_MPI_Primitive_Limiter(CGeometry *geometry, CConfig *config)
Impose the send-receive boundary condition.
su2double Total_CL
Total lift coefficient for all the boundaries.
su2double * Surface_CL
Lift coefficient for each monitoring surface.
void SetTotal_AeroCD(su2double val_aerocd)
Set the value of the Aero drag.
su2double Total_CFy
Total y force coefficient for all the boundaries.
su2double * CMz_Mnt
z Moment coefficient (inviscid contribution) for each boundary.
su2double AllBound_CNearFieldOF_Inv
Near-Field press coefficient (inviscid contribution) for all the boundaries.
su2double *** OldAverageTurboVelocity
su2double * CFy_Mnt
y Force coefficient (inviscid contribution) for each boundary.
void Set_MPI_Undivided_Laplacian(CGeometry *geometry, CConfig *config)
Parallelization of Undivided Laplacian.
su2double * Surface_CMx_Inv
x Moment coefficient (inviscid contribution) for each monitoring surface.
void Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output)
Compute primitive variables and their gradients.
su2double * CEff_Mnt
Efficiency (Cl/Cd) (inviscid contribution) for each boundary.
su2double Total_CL_Prev
Total lift coefficient for all the boundaries (fixed lift mode).
su2double AllBound_CT_Inv
Total thrust coefficient (inviscid contribution) for all the boundaries.
void SetActDisk_DeltaP(unsigned short val_marker, unsigned long val_vertex, su2double val_deltap)
Value of the characteristic global index at the boundaries.
void BC_NearField_Boundary(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short val_marker)
Impose the near-field boundary condition using the residual.
su2double ** ExtAverageOmega
void Set_MPI_Solution_Limiter(CGeometry *geometry, CConfig *config)
Impose the send-receive boundary condition.
su2double AllBound_CMerit_Mnt
Rotor Figure of Merit (inviscid contribution) for all the boundaries.
su2double ** LowMach_Precontioner
Auxiliary vector for storing the inverse of Roe-turkel preconditioner.
void MixedOut_Average(CConfig *config, su2double val_init_pressure, su2double *val_Averaged_Flux, su2double *val_normal, su2double &pressure_mix, su2double &density_mix)
it performs a mixed out average of the nodes of a boundary.
bool euler_implicit
True if euler implicit scheme used.
su2double Total_CFx
Total x force coefficient for all the boundaries.
int GetnSlidingStates(unsigned short val_marker, unsigned long val_vertex)
Get the number of outer state for fluid interface nodes.
void Pressure_Forces(CGeometry *geometry, CConfig *config)
Compute the pressure forces and all the adimensional coefficients.
su2double * CL_Mnt
Lift coefficient (inviscid contribution) for each boundary.
su2double AllBound_CFy_Inv
Total y force coefficient (inviscid contribution) for all the boundaries.
su2double * Surface_CSF
Side-force coefficient for each monitoring surface.
void Upwind_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short iMesh)
Compute the spatial integration using a upwind scheme.
su2double * Secondary_j
Auxiliary nPrimVar vector for storing the primitive at point j.
su2double AllBound_CT_Mnt
Total thrust coefficient (inviscid contribution) for all the boundaries.
su2double * Exhaust_Pressure
Fan face pressure for each boundary.
void Momentum_Forces(CGeometry *geometry, CConfig *config)
Compute the pressure forces and all the adimensional coefficients.
void ComputeTurboVelocity(su2double *cartesianVelocity, su2double *turboNormal, su2double *turboVelocity, unsigned short marker_flag, unsigned short marker_kindturb)
it take a velocity in the cartesian reference of framework and transform into the turbomachinery fram...
su2double * Primitive_j
Auxiliary nPrimVar vector for storing the primitive at point j.
unsigned long nMarker
Total number of markers using the grid information.
su2double ** PressureIn
su2double New_Func
Current value of the objective function (the function which is monitored).
void BC_Giles(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose the boundary condition using characteristic recostruction.
su2double Total_CoPz
Total z moment coefficient for all the boundaries.
virtual ~CEulerSolver(void)
Destructor of the class.
su2double * Surface_CEff_Inv
Side-force coefficient (inviscid contribution) for each monitoring surface.
su2double ** CPressure
Pressure coefficient for each boundary and vertex.
su2double ** KineIn
su2double * Surface_CMz_Mnt
z Moment coefficient (inviscid contribution) for each monitoring surface.
su2double ** ActDisk_DeltaP
Value of the Delta P.
su2double * Surface_CEff_Mnt
Side-force coefficient (inviscid contribution) for each monitoring surface.
void SetFreeStream_Solution(CConfig *config)
Set the solution using the Freestream values.
void BC_Inlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose a subsonic inlet boundary condition.
void SetDonorPrimVar(unsigned short val_marker, unsigned long val_vertex, unsigned short val_var, su2double val_value)
Value of the characteristic variables at the boundaries.
void SetUpwind_Ducros_Sensor(CGeometry *geometry, CConfig *config)
Compute Ducros Sensor for Roe Dissipation.
su2double AllBound_CoPx_Inv
Total x moment coefficient (inviscid contribution) for all the boundaries.
void BC_Outlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose the outlet boundary condition.
su2double Total_MaxHeat
Maximum heat flux on all boundaries.
su2double * CT_Mnt
Thrust coefficient (force in -x direction, inviscid contribution) for each boundary.
void Set_MPI_MaxEigenvalue(CGeometry *geometry, CConfig *config)
Parallelization of the Max eigenvalue.
su2double * CFy_Inv
y Force coefficient (inviscid contribution) for each boundary.
void PreprocessAverage(CSolver **solver, CGeometry *geometry, CConfig *config, unsigned short marker_flag)
It computes average quantities along the span for turbomachinery analysis.
su2double * CoPx_Mnt
x Moment coefficient (inviscid contribution) for each boundary.
su2double ** AverageDensity
void TurboAverageProcess(CSolver **solver, CGeometry *geometry, CConfig *config, unsigned short marker_flag)
It computes average quantities along the span for turbomachinery analysis.
void GatherInOutAverageValues(CConfig *config, CGeometry *geometry)
It gathers into the master node average quantities at inflow and outflow needed for turbomachinery an...
su2double * CFx_Mnt
x Force coefficient (inviscid contribution) for each boundary.
su2double * Surface_CL_Mnt
Lift coefficient (inviscid contribution) for each monitoring surface.
su2double * ForceInviscid
Inviscid force for each boundary.
su2double AllBound_CSF_Mnt
Total sideforce coefficient (inviscid contribution) for all the boundaries.
void SetTotal_NetThrust(su2double val_Total_NetThrust)
Store the total (inviscid + viscous) non dimensional drag coefficient.
su2double Total_SolidCD
Total drag coefficient for all the boundaries.
void BC_Supersonic_Inlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose a supersonic inlet boundary condition.
su2double ** ExtAveragePressure
su2double *** TurboVelocityOut
su2double Total_CQ
Total torque coefficient for all the boundaries.
su2double Total_HeatFluxDiff
Total Equivalent Area coefficient for all the boundaries.
su2double AllBound_CoPy_Mnt
Total y moment coefficient (inviscid contribution) for all the boundaries.
su2double * CoPx_Inv
x Moment coefficient (inviscid contribution) for each boundary.
void SetFreeStream_TurboSolution(CConfig *config)
Set the solution using the Freestream values.
void BC_Euler_Transpiration(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose via the residual the Euler wall boundary condition.
void ExplicitRK_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep)
Update the solution using a Runge-Kutta scheme.
su2double AllBound_CL_Mnt
Total lift coefficient (inviscid contribution) for all the boundaries.
su2double AllBound_CL_Inv
Total lift coefficient (inviscid contribution) for all the boundaries.
su2double * CMx_Inv
x Moment coefficient (inviscid contribution) for each boundary.
su2double AllBound_CMy_Mnt
Total y moment coefficient (inviscid contribution) for all the boundaries.
su2double AllBound_CoPx_Mnt
Total x moment coefficient (inviscid contribution) for all the boundaries.
su2double ** AveragePressure
su2double * GetDonorPrimVar(unsigned short val_marker, unsigned long val_vertex)
Value of the characteristic variables at the boundaries.
CEulerSolver(void)
Constructor of the class.
void BC_ActDisk(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker, bool val_inlet_surface)
Impose the engine inflow boundary condition.
su2double * Exhaust_MassFlow
Mass flow rate for each boundary.
void BC_Fluid_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config)
Impose the interface state across sliding meshes.
su2double AllBound_CEff_Mnt
Efficient coefficient (inviscid contribution) for all the boundaries.
su2double Total_CoPx
Total x moment coefficient for all the boundaries.
unsigned short nSpanWiseSections
Number of span-wise sections.
su2double * ForceMomentum
Inviscid force for each boundary.
su2double * CMy_Mnt
y Moment coefficient (inviscid contribution) for each boundary.
void SetResidual_DualTime(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep, unsigned short iMesh, unsigned short RunTime_EqSystem)
Set the total residual adding the term that comes from the Dual Time Strategy.
su2double AllBound_CFx_Mnt
Total x force coefficient (inviscid contribution) for all the boundaries.
su2double AllBound_CQ_Mnt
Total torque coefficient (inviscid contribution) for all the boundaries.
unsigned long BCThrust_Counter
su2double AllBound_CFy_Mnt
Total y force coefficient (inviscid contribution) for all the boundaries.
su2double Total_NetThrust
Total drag coefficient for all the boundaries.
su2double * Inflow_Pressure
Fan face pressure for each boundary.
su2double * Secondary
Auxiliary nPrimVar vector.
su2double * PrimVar_j
Auxiliary vector for storing the solution at point j.
void SetDonorGlobalIndex(unsigned short val_marker, unsigned long val_vertex, unsigned long val_index)
Value of the characteristic global index at the boundaries.
su2double * CSF_Inv
Sideforce coefficient (inviscid contribution) for each boundary.
void ComputeResidual_BGS(CGeometry *geometry, CConfig *config)
Set the value of the max residual and RMS residual.
void SetPrimitive_Gradient_GG(CGeometry *geometry, CConfig *config)
Compute the gradient of the primitive variables using Green-Gauss method, and stores the result in th...
su2double Total_Heat
Total heat load for all the boundaries.
void ClassicalRK4_Iteration(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iRKStep)
Update the solution using the classical fourth-order Runge-Kutta scheme.
void GetPower_Properties(CGeometry *geometry, CConfig *config, unsigned short iMesh, bool Output)
Compute the Fan face Mach number.
su2double AllBound_CSF_Inv
Total sideforce coefficient (inviscid contribution) for all the boundaries.
su2double AllBound_CoPy_Inv
Total y moment coefficient (inviscid contribution) for all the boundaries.
su2double * CMx_Mnt
x Moment coefficient (inviscid contribution) for each boundary.
void SetUndivided_Laplacian(CGeometry *geometry, CConfig *config)
Compute the undivided laplacian for the solution, except the energy equation.
void UpdateCustomBoundaryConditions(CGeometry **geometry_container, CConfig *config)
Update the multi-grid structure for the customized boundary conditions.
su2double * CFz_Mnt
z Force coefficient (inviscid contribution) for each boundary.
su2double AllBound_CFx_Inv
Total x force coefficient (inviscid contribution) for all the boundaries.
su2double * CFx_Inv
x Force coefficient (inviscid contribution) for each boundary.
su2double GetActDisk_DeltaT(unsigned short val_marker, unsigned long val_vertex)
Value of the characteristic global index at the boundaries.
su2double * MomentInviscid
Inviscid moment for each boundary.
su2double * Surface_CFy
y Force coefficient for each monitoring surface.
void BC_Custom(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short val_marker)
Impose the dirichlet boundary condition.
su2double * Surface_CSF_Inv
Side-force coefficient (inviscid contribution) for each monitoring surface.
void Source_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CNumerics *second_numerics, CConfig *config, unsigned short iMesh)
Source term integration.
su2double * Surface_CL_Inv
Lift coefficient (inviscid contribution) for each monitoring surface.
void SetPreconditioner(CConfig *config, unsigned long iPoint)
Compute the preconditioner for convergence acceleration by Roe-Turkel method.
su2double * CEquivArea_Inv
Equivalent area (inviscid contribution) for each boundary.
su2double Total_CT
Total thrust coefficient for all the boundaries.
su2double Total_CMz
Total z moment coefficient for all the boundaries.
void SetFarfield_AoA(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, bool Output)
Update the AoA and freestream velocity at the farfield.
su2double * Exhaust_Area
Boundary total area.
void SetTotal_ByPassProp_Eff(su2double val_Total_ByPassProp_Eff)
Store the total (inviscid + viscous) non dimensional drag coefficient.
su2double Total_CEff
Total efficiency coefficient for all the boundaries.
su2double * CMz_Inv
z Moment coefficient (inviscid contribution) for each boundary.
unsigned long SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output)
Compute the velocity^2, SoundSpeed, Pressure, Enthalpy, Viscosity.
su2double * Surface_CFy_Mnt
y Force coefficient (inviscid contribution) for each monitoring surface.
void SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned long Iteration)
Compute the time step for solving the Euler equations.
su2double * GetVelocity_Inf(void)
Get the velocity at the infinity.
su2double * Secondary_i
Auxiliary nPrimVar vector for storing the primitive at point i.
void SetPrimitive_Gradient_LS(CGeometry *geometry, CConfig *config)
Compute the gradient of the primitive variables using a Least-Squares method, and stores the result i...
su2double ** Inlet_Ttotal
Value of the Total T.
su2double * Surface_CMy_Mnt
y Moment coefficient (inviscid contribution) for each monitoring surface.
su2double Total_Power
Total drag coefficient for all the boundaries.
su2double AllBound_CMx_Inv
Total x moment coefficient (inviscid contribution) for all the boundaries.
su2double * Inflow_Mach
Fan face mach number for each boundary.
void BC_ActDisk_Inlet(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose the engine inflow boundary condition.
su2double * Surface_CFx
x Force coefficient for each monitoring surface.
su2double AllBound_CoPz_Mnt
Total z moment coefficient (inviscid contribution) for all the boundaries.
unsigned short nSpanMax
Max number of maximum span-wise sections for all zones.
su2double ** NuOut
su2double * CoPy_Mnt
y Moment coefficient (inviscid contribution) for each boundary.
su2double Total_CEquivArea
Total Equivalent Area coefficient for all the boundaries.
su2double * CoPy_Inv
y Moment coefficient (inviscid contribution) for each boundary.
su2double * Exhaust_Temperature
Fan face mach number for each boundary.
su2double Total_IDC
Total IDC coefficient for all the boundaries.
su2double * CMerit_Mnt
Rotor Figure of Merit (inviscid contribution) for each boundary.
su2double *** ExtAverageTurboVelocity
bool least_squares
True if computing gradients by least squares.
Main class for defining the variables of the compressible Euler solver.
su2double GetCp()
Get fluid specific heat at constant pressure.
Definition: fluid_model.inl:47
su2double GetdTdrho_e()
Get fluid temperature partial derivative.
Definition: fluid_model.inl:51
su2double GetPressure()
Get fluid pressure.
Definition: fluid_model.inl:40
su2double GetThermalConductivity()
Get fluid thermal conductivity.
Definition: fluid_model.inl:75
su2double GetdTde_rho()
Get fluid temperature partial derivative.
Definition: fluid_model.inl:52
virtual void SetTDState_hs(su2double h, su2double s)
virtual member that would be different for each gas model implemented
Definition: fluid_model.inl:96
su2double GetSoundSpeed()
Get fluid speed of sound.
Definition: fluid_model.inl:41
su2double Getdmudrho_T()
Get fluid dynamic viscosity partial derivative.
Definition: fluid_model.inl:67
su2double GetdhdP_rho()
Get fluid pressure partial derivative.
Definition: fluid_model.inl:54
virtual void SetTDState_rhoT(su2double rho, su2double T)
virtual member that would be different for each gas model implemented
Definition: fluid_model.inl:97
su2double Getdktdrho_T()
Get fluid thermal conductivity partial derivative.
Definition: fluid_model.inl:85
virtual void SetTDState_rhoe(su2double rho, su2double e)
virtual member that would be different for each gas model implemented
Definition: fluid_model.inl:93
su2double GetStaticEnergy()
Get fluid internal energy.
Definition: fluid_model.inl:45
su2double GetdktdT_rho()
Get fluid thermal conductivity partial derivative.
Definition: fluid_model.inl:89
su2double GetLaminarViscosity()
Get fluid dynamic viscosity.
Definition: fluid_model.inl:58
su2double GetdPde_rho()
Get fluid pressure partial derivative.
Definition: fluid_model.inl:50
virtual void ComputeDerivativeNRBC_Prho(su2double P, su2double rho)
virtual member that would be different for each gas model implemented
su2double GetDensity()
Get fluid density.
Definition: fluid_model.inl:43
virtual void SetTDState_PT(su2double P, su2double T)
virtual member that would be different for each gas model implemented
Definition: fluid_model.inl:94
su2double GetdmudT_rho()
Get fluid dynamic viscosity partial derivative.
Definition: fluid_model.inl:71
su2double GetdPdrho_e()
Get fluid pressure partial derivative.
Definition: fluid_model.inl:49
virtual void SetTDState_Prho(su2double P, su2double rho)
virtual member that would be different for each gas model implemented
Definition: fluid_model.inl:95
virtual void SetEnergy_Prho(su2double P, su2double rho)
virtual member that would be different for each gas model implemented
Definition: fluid_model.inl:98
void SetLaminarViscosityModel(CConfig *config)
Set viscosity model.
Definition: fluid_model.cpp:69
su2double GetEntropy()
Get fluid entropy.
Definition: fluid_model.inl:44
su2double GetTemperature()
Get fluid temperature.
Definition: fluid_model.inl:46
void SetThermalConductivityModel(CConfig *config)
Set thermal conductivity model.
Definition: fluid_model.cpp:82
su2double Getdhdrho_P()
Get fluid pressure partial derivative.
Definition: fluid_model.inl:53
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
CEdge ** edge
Edge vector (dual grid information).
virtual unsigned long GetGlobal_nPointDomain()
A virtual member.
virtual void SetControlVolume(CConfig *config, unsigned short action)
A virtual member.
unsigned short GetnDim(void)
Get number of coordinates.
unsigned long GetnVertexSpan(unsigned short val_marker, unsigned short val_span)
Get number of vertices.
su2double GetCustomBoundaryTemperature(unsigned short val_marker, unsigned long val_vertex)
Get the value of the customized temperature at a specified vertex on a specified marker.
virtual void SetRestricted_GridVelocity(CGeometry *fine_mesh, CConfig *config)
A virtual member.
unsigned short GetnMarker(void)
Get number of markers.
virtual su2double GetMinAngularCoord(unsigned short val_marker, unsigned short val_span)
A virtual member.
CTurboVertex **** turbovertex
Boundary Vertex vector ordered for turbomachinery calculation(dual grid information).
unsigned long GetnPointDomain(void)
Get number of real points (that belong to the domain).
unsigned long GetnVertex(unsigned short val_marker)
Get number of vertices.
virtual unsigned long GetnTotVertexSpan(unsigned short val_marker, unsigned short val_span)
A virtual member.
virtual void SetCoord(CGeometry *geometry)
A virtual member.
virtual void Set_MPI_GridVel(CConfig *config)
A virtual member.
virtual void Set_MPI_Coord(CConfig *config)
A virtual member.
CVertex *** vertex
Boundary Vertex vector (dual grid information).
virtual void SetMaxLength(CConfig *config)
A virtual member.
unsigned long GetnEdge(void)
Get number of edges.
virtual void SetCoord_CG(void)
A virtual member.
su2double GetCustomBoundaryHeatFlux(unsigned short val_marker, unsigned long val_vertex)
Get the value of the customized normal heat flux at a specified vertex on a specified marker.
virtual su2double GetAverageTangGridVel(unsigned short val_marker, unsigned short val_span)
A virtual member.
unsigned short GetnSpanWiseSections(unsigned short marker_flag)
Get number of span wise section.
su2double * GetSpanWiseValue(unsigned short val_marker)
Get number of vertices.
unsigned short GetnZone(void)
Get number of zones.
unsigned long GetnPoint(void)
Get number of points.
unsigned long GetnFreqSpanMax(unsigned short marker_flag)
Get number of max frequencies for initializing the Fourier Coefficient for NR BC.
virtual su2double * GetAverageTurboNormal(unsigned short val_marker, unsigned short val_span)
A virtual member.
virtual su2double GetMaxAngularCoord(unsigned short val_marker, unsigned short val_span)
A virtual member.
virtual void SetBoundControlVolume(CConfig *config, unsigned short action)
A virtual member.
CPoint ** node
Node vector (dual grid information).
unsigned long * nVertex
Number of vertex for each marker.
virtual su2double GetSpanArea(unsigned short val_marker, unsigned short val_span)
A virtual member.
virtual long GetGlobal_to_Local_Point(unsigned long val_ipoint)
A virtual member.
unsigned long GetnFreqSpan(unsigned short val_marker, unsigned short val_span)
Get number of frequencies per span for NRBC.
virtual su2double GetTurboRadius(unsigned short val_marker, unsigned short val_span)
A virtual member.
Child class for defining ideal gas model.
void SetRoe_Dissipation(CGeometry *geometry, CConfig *config)
A virtual member.
void Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output)
Restart residual and compute gradients.
void BC_Euler_Transpiration(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose via the residual the Euler wall boundary condition.
~CNSSolver(void)
Destructor of the class.
unsigned long SetPrimitive_Variables(CSolver **solver_container, CConfig *config, bool Output)
Compute the velocity^2, SoundSpeed, Pressure, Enthalpy, Viscosity.
CNSSolver(void)
Constructor of the class.
void SetTime_Step(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned long Iteration)
Compute the time step for solving the Navier-Stokes equations with turbulence model.
void Viscous_Residual(CGeometry *geometry, CSolver **solver_container, CNumerics *numerics, CConfig *config, unsigned short iMesh, unsigned short iRKStep)
Compute the viscous residuals.
su2double GetConjugateHeatVariable(unsigned short val_marker, unsigned long val_vertex, unsigned short pos_var)
Set the conjugate heat variables.
void Buffet_Monitoring(CGeometry *geometry, CConfig *config)
Compute the buffet sensor.
void Evaluate_ObjFunc(CConfig *config)
Compute weighted-sum "combo" objective output.
void BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose a constant heat-flux condition at the wall.
void Friction_Forces(CGeometry *geometry, CConfig *config)
Compute the viscous forces and all the addimensional coefficients.
void BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker)
Impose the Navier-Stokes boundary condition (strong).
void BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CConfig *config, unsigned short val_marker)
Impose the Navier-Stokes boundary condition (strong) with values from a CHT coupling.
void SetTauWall_WF(CGeometry *geometry, CSolver **solver_container, CConfig *config)
Computes the wall shear stress (Tau_Wall) on the surface using a wall function.
Main class for defining the variables of the compressible Navier-Stokes solver.
Class for defining the numerical methods.
void SetVelocity2_Inf(su2double val_velocity2)
Set the freestream velocity square.
void GetPMatrix_inv(su2double **val_invp_tensor, su2double *val_density, su2double *val_velocity, su2double *val_soundspeed, su2double *val_chi, su2double *val_kappa, su2double *val_normal)
Computation of the matrix P^{-1}, this matrix diagonalize the conservative Jacobians in the form $P^{...
void SetLambda(su2double val_lambda_i, su2double val_lambda_j)
Set the value of the spectral radius.
void SetWindGust(su2double *val_windgust_i, su2double *val_windgust_j)
Set the wind gust value.
void GetInviscidProjFlux(su2double *val_density, su2double *val_velocity, su2double *val_pressure, su2double *val_enthalpy, su2double *val_normal, su2double *val_Proj_Flux)
Compute the projected inviscid flux vector.
void SetPrimVarGradient(su2double **val_primvar_grad_i, su2double **val_primvar_grad_j)
Set the gradient of the primitive variables.
virtual void SetTauWall(su2double val_tauwall_i, su2double val_tauwall_j)
Set the value of the Tauwall.
virtual su2double GetPrecond_Beta()
Get the Preconditioning Beta.
void SetNeighbor(unsigned short val_neighbor_i, unsigned short val_neighbor_j)
Set the number of neighbor to a point.
void GetRMatrix(su2double val_pressure, su2double val_soundspeed, su2double val_density, su2double *val_velocity, su2double **val_invR_invPe)
Computation of the matrix R.
su2double GetDissipation()
Get the final Roe dissipation factor.
void SetNormal(su2double *val_normal)
Set the value of the normal vector to the face between two points.
void GetCharJump(su2double val_soundspeed, su2double val_density, su2double *prim_jump, su2double *char_jump)
Computation of the matrix R.
void GetPMatrix(su2double *val_density, su2double *val_velocity, su2double *val_soundspeed, su2double *val_enthalpy, su2double *val_chi, su2double *val_kappa, su2double *val_normal, su2double **val_p_tensor)
Computation of the matrix P for a generic fluid model.
void SetVolume(su2double val_volume)
Set the value of the volume of the control volume.
void SetSensor(su2double val_sensor_i, su2double val_sensor_j)
Set the value of the pressure sensor.
void SetCoord(su2double *val_coord_i, su2double *val_coord_j)
Set coordinates of the points.
void SetConservative(su2double *val_u_i, su2double *val_u_j)
Set the value of the conservative variables.
void SetSecondary(su2double *val_s_i, su2double *val_s_j)
Set the value of the primitive variables.
void ComputeResJacobianGiles(CFluidModel *FluidModel, su2double pressure, su2double density, su2double *turboVel, su2double alphaInBC, su2double gammaInBC, su2double **R_c, su2double **R_c_inv)
Computation of the flow Residual Jacoboan Matrix for Non Reflecting BC.
void SetUndivided_Laplacian(su2double *val_und_lapl_i, su2double *val_und_lapl_j)
Set the value of undivided laplacian.
virtual void ComputeResidual(su2double *val_residual, CConfig *config)
Compute the numerical residual.
void SetTurbKineticEnergy(su2double val_turb_ke_i, su2double val_turb_ke_j)
Set the turbulent kinetic energy.
void SetDissipation(su2double diss_i, su2double diss_j)
Sets the values of the roe dissipation.
void GetInviscidProjJac(su2double *val_velocity, su2double *val_energy, su2double *val_normal, su2double val_scale, su2double **val_Proj_Jac_tensor)
Compute the projection of the inviscid Jacobian matrices.
void SetGridVel(su2double *val_gridvel_i, su2double *val_gridvel_j)
Set the velocity of the computational grid.
void SetPrimitive(su2double *val_v_i, su2double *val_v_j)
Set the value of the primitive variables.
void SetWindGustDer(su2double *val_windgustder_i, su2double *val_windgustder_j)
Set the wind gust derivatives values.
Child class for defining the Peng-Robinson model.
void SetGridVel(unsigned short val_dim, su2double val_gridvel)
Set the value of the grid velocity at the point.
su2double GetVolume_nM1(void)
Get the volume of the control volume at time n+1.
bool GetDomain(void)
For parallel computation, its indicates if a point must be computed or not.
su2double GetWall_Distance(void)
Get the value of the distance to the nearest wall.
su2double GetVolume(void)
Get area or volume of the control volume.
bool GetPhysicalBoundary(void)
Provides information about if a point belong to the physical boundaries (without MPI).
su2double * GetGridVel(void)
Get the value of the grid velocity at the point.
void SetCoord(unsigned short val_dim, su2double val_coord)
Set the coordinates for the control volume.
unsigned short GetnNeighbor(void)
Get the number of neighbor of a point.
su2double GetMaxLength(void)
Get the maximum cell-center to cell-center length.
unsigned long GetChildren_CV(unsigned short val_nchildren_CV)
Get the children control volume of an agglomerated control volume.
su2double GetCoord(unsigned short val_dim)
Get the coordinates dor the control volume.
unsigned short GetnChildren_CV(void)
Get the number of children of an agglomerated control volume.
void SetnNeighbor(unsigned short val_nneighbor)
Set the number of neighbor (artificial dissipation).
unsigned long GetPoint(unsigned short val_point)
Get all the points that compose the control volume.
unsigned long GetGlobalIndex(void)
Get the global index in a parallel computation.
unsigned short GetnPoint(void)
Get the number of points that compose the control volume.
Main class for defining the PDE solution, it requires a child class for each particular solver (Euler...
void AddRes_Max_BGS(unsigned short val_var, su2double val_residual, unsigned long val_point, su2double *val_coord)
Adds the maximal residual for BGS subiterations.
unsigned short nPrimVarGrad
Number of primitive variables of the problem in the gradient computation.
su2double ** Jacobian_j
Auxiliary matrices for storing point to point Jacobians at point j.
su2double * Residual_Max_BGS
Vector with the maximal residual for each variable for BGS subiterations.
void SetRes_BGS(unsigned short val_var, su2double val_residual)
Set the residual for BGS subiterations.
su2double ** Cvector
Auxiliary structure for computing gradients by least-squares.
CSysMatrix Jacobian
Complete sparse Jacobian structure for implicit computations.
CSysVector LinSysRes
vector to store iterative residual of implicit linear system.
su2double * Residual_j
Auxiliary nVar vector for storing the residual at point j.
unsigned short nDim
Number of dimensions of the problem.
su2double ** Jacobian_i
Auxiliary matrices for storing point to point Jacobians at point i.
virtual void SetRoe_Dissipation(CGeometry *geometry, CConfig *config)
A virtual member.
su2double Min_Delta_Time
Minimum value of the delta time for all the control volumes.
su2double * Residual_RMS
Vector with the mean residual for each variable.
su2double * Residual_i
Auxiliary nVar vector for storing the residual at point i.
int size
MPI Size.
void AddRes_RMS(unsigned short val_var, su2double val_residual)
Adds the maximal residual, this is useful for the convergence history.
void Read_SU2_Restart_Metadata(CGeometry *geometry, CConfig *config, bool adjoint_run, string val_filename)
Read the metadata from a native SU2 restart file (ASCII or binary).
virtual void SetOmega_Max(su2double val_omega_max)
A virtual member.
int * Restart_Vars
Auxiliary structure for holding the number of variables and points in a restart.
su2double * Res_Conv
Auxiliary nVar vector for storing the convective residual.
su2double * Res_Sour
Auxiliary nVar vector for storing the viscous residual.
void SetIterLinSolver(unsigned short val_iterlinsolver)
Set number of linear solver iterations.
unsigned long nPoint
Number of points of the computational grid.
su2double ** Smatrix
Auxiliary structure for computing gradients by least-squares.
CSysVector LinSysSol
vector to store iterative solution of implicit linear system.
int rank
MPI Rank.
virtual void Preprocessing(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, unsigned short iRKStep, unsigned short RunTime_EqSystem, bool Output)
A virtual member.
unsigned short nSecondaryVarGrad
Number of primitive variables of the problem in the gradient computation.
virtual void LoadRestart(CGeometry **geometry, CSolver ***solver, CConfig *config, int val_iter, bool val_update_geo)
A virtual member.
su2double ** Point_Max_Coord
Vector with pointers to the coords of the maximal residual for each variable.
su2double ** Point_Max_Coord_BGS
Vector with pointers to the coords of the maximal residual for each variable.
su2double * Res_Visc
Auxiliary nVar vector for storing the viscous residual.
unsigned short nVar
Number of variables of the problem.
void SetRes_RMS(unsigned short val_var, su2double val_residual)
Set the maximal residual, this is useful for the convergence history.
su2double * Vector
Auxiliary nDim vector.
unsigned long * Point_Max
Vector with the maximal residual for each variable.
void SetResidual_RMS(CGeometry *geometry, CConfig *config)
Set the value of the max residual and RMS residual.
void Read_SU2_Restart_Binary(CGeometry *geometry, CConfig *config, string val_filename)
Read a native SU2 restart file in binary format.
su2double * Residual_Max
Vector with the maximal residual for each variable.
virtual void SetStrainMag_Max(su2double val_strainmag_max)
A virtual member.
void AddRes_Max(unsigned short val_var, su2double val_residual, unsigned long val_point, su2double *val_coord)
Adds the maximal residual, this is useful for the convergence history.
su2double Max_Delta_Time
Maximum value of the delta time for all the control volumes.
CVariable ** node
Vector which the define the variables for each problem.
void AddRes_BGS(unsigned short val_var, su2double val_residual)
Adds the residual for BGS subiterations.
su2double * Solution
Auxiliary nVar vector.
unsigned long nPointDomain
Number of points of the computational grid.
su2double * Solution_j
Auxiliary nVar vector for storing the solution at point j.
su2double * Solution_i
Auxiliary nVar vector for storing the solution at point i.
su2double * Residual_BGS
Vector with the mean residual for each variable for BGS subiterations.
su2double * Residual
Auxiliary nVar vector.
unsigned short nPrimVar
Number of primitive variables of the problem.
virtual void Set_MPI_Solution_Old(CGeometry *geometry, CConfig *config)
Set number of linear solver iterations.
virtual void Set_MPI_Solution(CGeometry *geometry, CConfig *config)
Set number of linear solver iterations.
void Read_SU2_Restart_ASCII(CGeometry *geometry, CConfig *config, string val_filename)
Read a native SU2 restart file in ASCII format.
passivedouble * Restart_Data
Auxiliary structure for holding the data values from a restart.
void SetResidual_BGS(CGeometry *geometry, CConfig *config)
Communicate the value of the max residual and RMS residual.
virtual su2double GetTke_Inf(void)
A virtual member.
void SetRes_Max(unsigned short val_var, su2double val_residual, unsigned long val_point)
Set the maximal residual, this is useful for the convergence history.
unsigned long * Point_Max_BGS
Vector with the maximal residual for each variable.
void SetRes_Max_BGS(unsigned short val_var, su2double val_residual, unsigned long val_point)
Set the maximal residual for BGS subiterations.
su2double * Vector_i
Auxiliary nDim vector to do the reconstruction of the variables at point i.
su2double * Vector_j
Auxiliary nDim vector to do the reconstruction of the variables at point j.
unsigned short nVarGrad
Number of variables for deallocating the LS Cvector.
unsigned short nSecondaryVar
Number of primitive variables of the problem.
void SubtractBlock(unsigned long block_i, unsigned long block_j, su2double **val_block)
Subtracts the specified block to the sparse matrix.
unsigned short BuildLineletPreconditioner(CGeometry *geometry, CConfig *config)
Build the Linelet preconditioner.
void Initialize(unsigned long nPoint, unsigned long nPointDomain, unsigned short nVar, unsigned short nEqn, bool EdgeConnect, CGeometry *geometry, CConfig *config)
Initializes space matrix system.
void DeleteValsRowi(unsigned long i)
Deletes the values of the row i of the sparse matrix.
void AddVal2Diag(unsigned long block_i, su2double val_matrix)
Adds the specified value to the diagonal of the (i, i) subblock of the matrix-by-blocks structure.
void AddBlock(unsigned long block_i, unsigned long block_j, su2double **val_block)
Adds the specified block to the sparse matrix.
void SetValZero(void)
Sets to zero all the entries of the sparse matrix.
void SetVal2Diag(unsigned long block_i, su2double val_matrix)
Sets the specified value to the diagonal of the (i, i) subblock of the matrix-by-blocks structure.
Class for solving linear systems using classical and Krylov-subspace iterative methods.
unsigned long Solve(CSysMatrix &Jacobian, CSysVector &LinSysRes, CSysVector &LinSysSol, CGeometry *geometry, CConfig *config)
Solve the linear system using a Krylov subspace method.
void AddBlock(unsigned long val_ipoint, su2double *val_residual)
Add val_residual to the residual.
su2double * GetBlock(unsigned long val_ipoint)
Get the value of the residual.
void SubtractBlock(unsigned long val_ipoint, su2double *val_residual)
Subtract val_residual to the residual.
void SetBlock_Zero(unsigned long val_ipoint)
Set the residual to zero.
void Initialize(const unsigned long &numBlk, const unsigned long &numBlkDomain, const unsigned short &numVar, const su2double &val=0.0)
Initialize the class.
su2double GetRelAngularCoord(void)
get angular coord.
su2double GetDeltaAngularCoord(void)
get angular coord.
void GetTurboNormal(su2double *val_normal)
Copy the the turbo normal vector of a face.
su2double GetArea(void)
get face Area associate to the vertex.
unsigned long GetOldVertex(void)
retrieve vertex value not ordered.
Child class for defining the Van der Waals model.
Main class for defining the variables.
virtual su2double GetProjVel(su2double *val_vector)
A virtual member.
virtual su2double GetTemperature(void)
A virtual member.
virtual su2double GetSecondary(unsigned short val_var)
A virtual member.
virtual void SetPreconditioner_Beta(su2double val_Beta)
Set the value of the preconditioner Beta.
virtual void SetVel_ResTruncError_Zero(unsigned short iSpecies)
Set the velocity of the truncation error to zero.
su2double GetMax_Lambda_Inv(void)
Get the value of the maximum eigenvalue for the inviscid terms of the PDE.
su2double GetSolution_Max(unsigned short val_var)
Get the value of the min solution.
su2double * GetUndivided_Laplacian(void)
Get the undivided laplacian of the solution.
virtual su2double GetHarmonicBalance_Source(unsigned short val_var)
A virtual member.
su2double * GetSolution_time_n1(void)
Get the solution at time n-1.
void AddMax_Lambda_Inv(su2double val_max_lambda)
Add a value to the maximum eigenvalue for the inviscid terms of the PDE.
virtual su2double GetGradient_Primitive(unsigned short val_var, unsigned short val_dim)
A virtual member.
virtual su2double GetLimiter_Primitive(unsigned short val_var)
A virtual member.
void SetMax_Lambda_Visc(su2double val_max_lambda)
Set the value of the maximum eigenvalue for the viscous terms of the PDE.
su2double GetSensor(void)
Get the pressure sensor.
virtual su2double GetSoundSpeed(void)
A virtual member.
void SetSolution(su2double *val_solution)
Set the value of the solution.
virtual void SetRoe_Dissipation_FD(su2double val_wall_dist)
A virtual member.
virtual su2double GetVelocity(unsigned short val_dim)
A virtual member.
virtual void SetRoe_Dissipation_NTS(su2double val_delta, su2double val_const_DES)
A virtual member.
su2double GetMax_Lambda_Visc(void)
Get the value of the maximum eigenvalue for the viscous terms of the PDE.
virtual su2double GetDensity(void)
A virtual member.
void SetSensor(su2double val_sensor)
Set pressure sensor.
virtual su2double GetEnthalpy(void)
A virtual member.
virtual void Set_BGSSolution_k(void)
A virtual member. Set the value of the old geometry solution (adjoint).
virtual su2double GetEddyViscosity(void)
A virtual member.
su2double GetSolution(unsigned short val_var)
Get the solution.
virtual su2double GetPrimitive(unsigned short val_var)
A virtual member.
su2double * GetResTruncError(void)
Get the truncation error.
virtual su2double * GetWindGust()
Get the value of the wind gust.
virtual su2double GetVelocity2(void)
A virtual member.
virtual bool SetStrainMag(void)
A virtual member.
virtual bool SetVorticity(void)
A virtual member.
void SetTranspiration(su2double val)
virtual void SetDES_LengthScale(su2double val_des_lengthscale)
A virtual member.
virtual void AddSolution_New(unsigned short val_var, su2double val_solution)
A virtual member.
virtual su2double GetDES_LengthScale(void)
A virtual member.
su2double GetTranspiration(void)
void AddSolution(unsigned short val_var, su2double val_solution)
Add a value to the solution.
su2double GetNon_Physical(void)
Get the value of the non-physical point.
virtual void SetTauWall(su2double val_tau_wall)
virtual su2double GetEnergy(void)
A virtual member.
void AddLambda(su2double val_lambda)
Add the value of the spectral radius.
su2double GetLambda(void)
Get the value of the spectral radius.
virtual su2double GetRoe_Dissipation(void)
A virtual member.
virtual su2double Get_BGSSolution_k(unsigned short iDim)
A virtual member. Get the value of the old geometry solution (adjoint).
virtual su2double GetPressure(void)
A virtual member.
virtual su2double GetTauWall()
virtual su2double * GetVorticity(void)
A virtual member.
void SetDelta_Time(su2double val_delta_time)
Set the value of the time step.
virtual void SetVelocity_Old(su2double *val_velocity)
A virtual member.
virtual void SetLimiter_Primitive(unsigned short val_var, su2double val_value)
A virtual member.
su2double GetSolution_Min(unsigned short val_var)
Get the value of the min solution.
su2double GetDelta_Time(void)
Get the value of the time step.
virtual void SubtractGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value)
A virtual member.
void SetSolution_Old(su2double *val_solution_old)
Set the value of the old solution.
void Set_Solution_time_n1(void)
Set the variable solution at time n-1.
void SetMax_Lambda_Inv(su2double val_max_lambda)
Set the value of the maximum eigenvalue for the inviscid terms of the PDE.
virtual su2double GetmuT(void)
Get the value of the eddy viscosity.
void SetSolution_Min(unsigned short val_var, su2double val_solution)
Set the value of the min solution.
void SetSolution_Max(unsigned short val_var, su2double val_solution)
Set the value of the max solution.
virtual void SetSecondaryVar(CFluidModel *FluidModel)
A virtual member.
virtual void SetRoe_Dissipation(su2double val_dissipation)
A virtual member.
void Set_Solution_time_n(void)
Set the variable solution at time n.
virtual bool SetPrimVar(CConfig *config)
A virtual member.
su2double * GetSolution_time_n(void)
Get the solution at time n.
virtual su2double * GetWindGustDer()
Get the value of the derivatives of the wind gust.
void SetNon_Physical(bool val_value)
Set the value of the non-physical point.
virtual su2double GetLaminarViscosity(void)
A virtual member.
virtual void SetGradient_Primitive(unsigned short val_var, unsigned short val_dim, su2double val_value)
A virtual member.
void SetLambda(su2double val_lambda)
Set the value of the spectral radius.
virtual su2double GetStrainMag(void)
A virtual member.
void GetNormal(su2double *val_normal)
Copy the the normal vector of a face.
long GetDonorProcessor(void)
Get the value of the periodic point of a vertex.
short GetRotation_Type(void)
Get the type of rotation associated to the vertex.
long GetDonorVertex(void)
Get the value of the periodic point of a vertex.
unsigned long GetNormal_Neighbor(void)
Get the value of the closest neighbor.
unsigned long GetNode(void)
Get the node of the vertex.
long GetDonorMarker(void)
Get the value of the periodic point of a vertex.
codi::RealForward su2double
const su2double eps
machine epsilon
#define MPI_COMM_WORLD
#define MPI_INT
#define MPI_MAX
#define CURRENT_FUNCTION
#define MPI_UNSIGNED_LONG
#define MPI_SUM
#define MPI_MIN
#define MPI_DOUBLE
#define MPI_LONG
#define MPI_UNSIGNED_SHORT
void StartPreacc()
Starts a new preaccumulation section and sets the input variables.
void EndPreacc()
Ends a preaccumulation section and computes the local Jacobi matrix of a code section using the varia...
void SetPreaccIn(const su2double &data)
Sets the scalar input of a preaccumulation section.
void SetPreaccOut(su2double &data)
Sets the scalar output of a preaccumulation section.
void SetDerivative(su2double &data, const double &val)
Set the derivative value of the datatype (needs to be implemented for each new type).
double GetSecondary(const su2double &data)
Get the secondary value of the datatype (needs to be implemented for each new type).
int Int(const su2double &data)
Casts the primitive value to int (uses GetValue, already implemented for each type).
const int MASTER_NODE
Master node for MPI parallelization.
const su2double PI_NUMBER
Pi number.
@ NO_HYBRIDRANSLES
No turbulence model.
@ NO
Boolean definition of no.
@ YES
Boolean definition of yes.
@ TURKEL
Roe-Turkel's upwind numerical method.
@ ROE
Roe's upwind numerical method.
@ BARTH_JESPERSEN
Slope limiter using Barth-Jespersen method (stencil formulation).
@ VENKATAKRISHNAN
Slope limiter using Venkatakrisnan method (stencil formulation).
@ VENKATAKRISHNAN_WANG
Slope limiter using Venkatakrisnan method, eps based on solution (stencil formulation).
@ NO_LIMITER
No limiter.
@ VAN_ALBADA_EDGE
Slope limiter using Van Albada method (edge formulation).
@ TEMPERATURE_FS
_____.
@ D_AOA
Derivative with respect to the angle of attack.
@ D_TEMPERATURE
Derivative with respect to the freestream temperature.
@ D_PRESSURE
Derivative with respect to the freestream pressure.
@ D_DESIGN
@ D_REYNOLDS
@ D_DENSITY
@ D_VISCOSITY
@ D_MACH
Derivative with respect to the mach number.
@ D_TURB2LAM
@ NO_DERIVATIVE
@ D_SIDESLIP
const su2double STANDARD_GRAVITY
Acceleration due to gravity at surface of earth.
@ SMOOTHER_LINELET
Linelet smoother.
@ EULER_IMPLICIT
Implicit Euler time integration definition.
const su2double EPS
Error scale.
const int FLOW_SOL
Position of the mean flow solution in the solver container array.
@ SPACE_CENTERED
Space centered convective numerical method.
@ CONSTANT_CONDUCTIVITY
_____.
@ CONSTANT_PRANDTL
@ VARIABLES_JUMP
User specifies the variables jump.
@ POWER
User specifies the power.
@ BC_THRUST
User specifies the BC thrust.
@ DRAG_MINUS_THRUST
User specifies the D-T.
@ NET_THRUST
User specifies the Net thrust.
@ MASSFLOW
User specifies the massflow.
@ JST
Jameson-Smith-Turkel centered numerical method.
const unsigned int MESH_0
Definition of the finest grid level.
@ TOTAL_HEATFLUX
Total heat flux.
@ FORCE_Y_COEFFICIENT
Y-direction force objective function definition.
@ SURFACE_MASSFLOW
Mass Flow Rate objective function definition.
@ TORQUE_COEFFICIENT
Torque objective function definition.
@ SURFACE_MACH
Mach number objective function definition.
@ MAXIMUM_HEATFLUX
Maximum heat flux.
@ THRUST_COEFFICIENT
Thrust objective function definition.
@ SURFACE_MOM_DISTORTION
Momentum distortion objective function definition.
@ BLOWING_COEFFICIENT
Jet blowing coefficient objective function definition.
@ SURFACE_SECOND_OVER_UNIFORM
Secondary over uniformity (relative secondary strength) objective function definition.
@ BUFFET_SENSOR
Sensor for detecting separation.
@ MOMENT_X_COEFFICIENT
Pitching moment objective function definition.
@ SIDEFORCE_COEFFICIENT
Side force objective function definition.
@ LIFT_COEFFICIENT
Lift objective function definition.
@ INVERSE_DESIGN_HEATFLUX
Heat flux objective function definition (inverse design).
@ SURFACE_SECONDARY
Secondary flow strength objective function definition.
@ INVERSE_DESIGN_PRESSURE
Pressure objective function definition (inverse design).
@ EFFICIENCY
Efficiency objective function definition.
@ FORCE_Z_COEFFICIENT
Z-direction force objective function definition.
@ DRAG_COEFFICIENT
Drag objective function definition.
@ NEARFIELD_PRESSURE
NearField Pressure objective function definition.
@ SURFACE_TOTAL_PRESSURE
Total Pressure objective function definition.
@ MOMENT_Y_COEFFICIENT
Rolling moment objective function definition.
@ FORCE_X_COEFFICIENT
X-direction force objective function definition.
@ CUSTOM_OBJFUNC
Custom objective function definition.
@ EQUIVALENT_AREA
Equivalent area objective function definition.
@ FIGURE_OF_MERIT
Rotor Figure of Merit objective function definition.
@ SURFACE_STATIC_PRESSURE
Static Pressure objective function definition.
@ SURFACE_UNIFORMITY
Flow uniformity objective function definition.
@ MOMENT_Z_COEFFICIENT
Yawing objective function definition.
@ NO_WALL_FUNCTION
No wall function treatment, integration to the wall. Default behavior.
@ RADIAL_EQUILIBRIUM
@ STATIC_SUPERSONIC_INFLOW_PD
User specifies static pressure, static temperature, and Mach components.
@ TOTAL_CONDITIONS_PT
User specifies total pressure, total temperature, and flow direction.
@ MIXING_OUT
User does not specify anything information are retrieved from the other domain.
@ MIXING_IN_1D
@ DENSITY_VELOCITY
User specifies density and velocity, and flow direction.
@ MIXING_OUT_1D
@ MIXING_IN
User does not specify anything information are retrieved from the other domain.
@ STATIC_PRESSURE_1D
@ STATIC_PRESSURE
User specifies static pressure.
@ TOTAL_CONDITIONS_PT_1D
@ STATIC_SUPERSONIC_INFLOW_PT
User specifies static pressure, static temperature, and Mach components.
@ HARMONIC_BALANCE
Use a harmonic balance source term.
@ DT_STEPPING_1ST
Use a dual time stepping strategy for unsteady computations (1st order).
@ TIME_STEPPING
Use a time stepping strategy for unsteady computations.
@ DT_STEPPING_2ND
Use a dual time stepping strategy for unsteady computations (2nd order).
@ STEADY
A steady computation.
const int TURB_SOL
Position of the turbulence model solution in the solver container array.
@ RUNTIME_FLOW_SYS
One-physics case, the code is solving the flow equations(Euler and Navier-Stokes).
@ RANS
Definition of the Reynolds-averaged Navier-Stokes' (RANS) solver.
@ DISC_ADJ_RANS
@ ADJ_RANS
Definition of the continuous adjoint Reynolds-averaged Navier-Stokes' (RANS) solver.
@ NTS
Numerical Blending of Travin and Shur.
@ NO_ROELOWDISS
No Roe Low Dissipation model.
@ NTS_DUCROS
Numerical Blending of Travin and Shur + Ducros' Shock Sensor.
@ FD_DUCROS
Numerical Blending based on DDES's F_d function + Ducros' Shock Sensor.
@ FD
Numerical Blending based on DDES's F_d function.
@ SUTHERLAND
@ CONSTANT_VISCOSITY
_____.
const su2double TWO3
Two divided by three.
@ RATIO
Jump given by a ratio.
@ ENGINE_EXHAUST
Boundary nacelle exhaust.
@ INTERNAL_BOUNDARY
Internal Boundary definition.
@ EULER_WALL
Boundary Euler wall definition.
@ ISOTHERMAL
No slip isothermal wall boundary condition.
@ TRANSPIRATION
Transpiration definition.
@ SEND_RECEIVE
Boundary send-receive definition.
@ INLET_FLOW
Boundary inlet flow definition.
@ ACTDISK_OUTLET
Actuator disk outlet boundary definition.
@ OUTLET_FLOW
Boundary outlet flow definition.
@ ENGINE_INFLOW
Boundary nacelle inflow.
@ HEAT_FLUX
No slip constant heat flux wall boundary condition.
@ FLUID_INTERFACE
Domain interface definition.
@ NEARFIELD_BOUNDARY
Near-Field boundary definition.
@ INTERFACE_BOUNDARY
Domain interface boundary definition.
@ ACTDISK_INLET
Actuator disk inlet boundary definition.
@ PERIODIC_BOUNDARY
Periodic boundary definition.
@ MASSFLUX
a mass flow average is computed at the boundary of interest.
@ AREA
an area average is computed at the boundary of interest.
@ MIXEDOUT
an mixed-out average is computed at the boundary of interest.
@ ALGEBRAIC
an algebraic average is computed at the boundary of interest.
@ LINELET
Line implicit preconditioner.
@ MASS_FLOW
User specifies density and velocity (mass flow).
@ TOTAL_CONDITIONS
User specifies total pressure, total temperature, and flow direction.
@ FREESTREAM_PRESS_EQ_ONE
Non-dimensional compressible simulation with freestream pressure equal to 1.0.
@ DIMENSIONAL
Dimensional simulation (compressible or incompressible).
@ FREESTREAM_VEL_EQ_MACH
Non-dimensional compressible simulation with freestream velocity equal to Mach number.
@ FREESTREAM_VEL_EQ_ONE
Non-dimensional compressible simulation with freestream pressure equal to 1.0.
@ INFLOW
flag for inflow marker for compute turboperformance.
@ OUTFLOW
flag for outflow marker for compute turboperformance.
@ IDEAL_GAS
_____.
@ STANDARD_AIR
@ VW_GAS
@ PR_GAS
const unsigned int NO_RK_ITER
No Runge-Kutta iteration.
@ FAN_FACE_PRESSURE
User specifies Static pressure.
@ FAN_FACE_MACH
User specifies fan face mach number.
@ FAN_FACE_MDOT
User specifies Static pressure.
@ REYNOLDS
_____.
@ SST
Kind of Turbulence model (Menter SST).
@ SA_NEG
Kind of Turbulent model (Spalart-Allmaras).
@ SA
Kind of Turbulent model (Spalart-Allmaras).
@ VERB_HIGH
High level of verbosity.
@ WEIGHTED_LEAST_SQUARES
Gradients computation using Weighted Least Squares.
@ GREEN_GAUSS
Gradients computation using Green Gauss theorem.
@ US
Definition of incompressible solver.
@ SI
Definition of compressible solver.
@ UPDATE
Update geometry structure (grid moving, adaptation, etc.).